How to copy the last pre-filled cell with autofill for as below?

Viewed 25

I'm creating code where I need the column where the date is to use autofill. However, this column (AA) has to always be copied from the last cell filled in AA to the last one filled based on A. But I'm experiencing error in range

That's the code. He's copying the date into AE2 and copying below the last filled cell, but I need the TypeCopy autofill for the other one below it. I thank you now

Sub sub_()
Call Atualizar_ME5A
Application.Wait Now + TimeValue("00:00:03")
Call Atualizar_


End Sub
Sub Atualizar_ME5A()

 
 Range("AE2").Select

Selection.Copy

Range("AA2").Select

linha = Range("AA2").End(xlDown).Row + 1
inha2 = Range("AA2").End(xlDown).Row


Range("AA" & linha).PasteSpecial xlPasteValues
Application.CutCopyMode = False


End Sub
Sub Atualizar_()
linhaa = Range("AA2").End(xlDown).Row
Range("AA" & linhaa).autoFill Destination:=Range("AA" & Cells(Rows.Count, "y").End(xlDown).Row)
End Sub
0 Answers
Related