Loop

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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
 
Back
Top