Loop

G

Guest

Hi All,

I have a fairy easy question but I can't find the correct answer:

I have 2 excelsheets File1.xls and File2.xls
On File1.xls there is one cell (C6) that I want to copy to file2.xls in
Range A if there is a value in Range B from file2.xls

So I need to create a loop function but I can't find the right one.

Can anyone help me with this?

Thanks!

BR
 
D

Dave Peterson

Sometimes you don't have to loop:



Dim wks1 as worksheet
dim wks2 as worksheet
dim LastRow as long

set wks1 = workbooks("file1.xls").worksheets("sheet999")
set wks2 = workbooks("file2.xls").worksheets("sheet888")

with wks2
lastrow = .cells(.rows.count,"B").end(xlup).row
.range("a1:A" & lastrow).value = wks.range("c6").value
end with
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top