1004
is a Object Defined Error
which resulted from Range(AOFF)
.
Excel doesn't recognize such non-existent Range.
Dan pointed out a solution to propertly declare your variables using Set
.
But what simoco pointed out is true as well, there is no .Paste
method in Range Object
.
so let's re-write your code to:
Dim rOWIS As Integer
Dim AOFF As Range
With ActiveSheet
rOWIS = .Range("A" & .Rows.Count).End(xlUp).Row
.Range("A" & rOWIS).Copy
'~~> as what Dan commented
Set AOFF = ActiveSheet.Range("A" & rOWIS).Offset(1, 0)
'~~> as simoco commented
AOFF.PasteSpecial xlPasteAll
End With
Above should work. I leave the testing to you.
Also refer to THIS to avoid runtimes.
Edit1: Here is a shorter version of your code applying what's discussed in the link.
Dim AOFF As Range
With ActiveSheet
Set AOFF = .Range("A" & .Rows.Count).End(xlup)
AOFF.Copy AOFF.Offset(1, 0)
End With