Hi,
I want to loop until the last cell in another workbook. Both workbooks are open. Here is some of my code. I can't get the loop until part to stop at the named range of Wk2. any help would be appreciated.
Set Wk1 = ThisWorkbook
Compare = InputBox("Favor selecionar a data para comparaçao (dd_mm_aa) :")
Workbooks.Open Filename:="L:\sumprimentos\Catherine\Tasks\Transito desembaraço\" & Compare & "_FIAT"
Set Wk2 = ActiveWorkbook
Wk2.Names.Add Name:="lastcell", RefersTo:=Range("A65536").End(xlUp)
Range("A11").Select
Do
Wk2.Activate
If ActiveCell.Interior.ColorIndex = 36 Then GoTo 12 Else GoTo 11
12
ActiveCell.Copy
ActiveCell.Offset(1, 0).Select
Wk1.Activate
ActiveCell.Select
Selection.PasteSpecial Paste:=xlPasteValues
11
ActiveCell.Offset(1, 0).Select
Loop Until Workbooks("Wk2").Sheets("SDM PM FIAT").Range(lastcell)
Thanks!
I want to loop until the last cell in another workbook. Both workbooks are open. Here is some of my code. I can't get the loop until part to stop at the named range of Wk2. any help would be appreciated.
Set Wk1 = ThisWorkbook
Compare = InputBox("Favor selecionar a data para comparaçao (dd_mm_aa) :")
Workbooks.Open Filename:="L:\sumprimentos\Catherine\Tasks\Transito desembaraço\" & Compare & "_FIAT"
Set Wk2 = ActiveWorkbook
Wk2.Names.Add Name:="lastcell", RefersTo:=Range("A65536").End(xlUp)
Range("A11").Select
Do
Wk2.Activate
If ActiveCell.Interior.ColorIndex = 36 Then GoTo 12 Else GoTo 11
12
ActiveCell.Copy
ActiveCell.Offset(1, 0).Select
Wk1.Activate
ActiveCell.Select
Selection.PasteSpecial Paste:=xlPasteValues
11
ActiveCell.Offset(1, 0).Select
Loop Until Workbooks("Wk2").Sheets("SDM PM FIAT").Range(lastcell)
Thanks!