Obrigado, meu camarada!
É exatamente isso!
Acabei a macro agora!
Set wb2 = ActiveWorkbook
wb2.Activate
Sheets("A").Select
ultimalinhawb2 = Cells(Rows.Count, 2).End(xlUp).Row
procdata = Cells(ultimalinhawb2 - 2, 2)
Workbooks.Open Filename:= _
"Y:marketingHugoB2WQtd_Junk_B2W.xlsx" _
, Notify:=False
Set wb3 = ActiveWorkbook
ultimalinhawb3 = Cells(Rows.Count, 2).End(xlUp).Row
Sheets("Plan1").Activate
Selection.ListObject.QueryTable.Refresh BackgroundQuery:=False
cont = 1
Do While Sheets("Plan1").Cells(cont, 1).Value <> "S"
cont = cont + 1
Loop
For j = cont - 2 To cont
Ano = Mid(Cells(j, 3).Value, 1, 4)
Mes = Mid(Cells(j, 3).Value, 5, 2)
Dia = Mid(Cells(j, 3).Value, 7, 2)
Data = Dia & "/" & Mes & "/" & Ano
If Data = procdata Then
wb2.Sheets("A").Cells(ultimalinhawb2 - 2, 13).Value = wb3.Sheets("Plan1").Cells(j, 4).Value
End If
Next j
Postado : 16/04/2013 2:19 pm