To give you a starting point, here are some examples of using autofill on another sheet after copy/paste.
First - Copy the range you are going to use to the other worksheet
Second - Select the range on the worksheet you are going to autofill
Third - When using Resize
the number has to be bigger then the range because when selecting a range the focus is on the first cell in the range. e.g. If not greater
then Range("A1:A10").resize(5).Select
the selected range will be Range("A1:A5")
, thus not autofill action.
Different ways to Resize
are:
Sheets("Sheet3").Range("A1:B10").AutoFill Destination:=Sheets("Sheet3").Range("A1:B10").Resize(20), Type:=xlFillDefault
Or
Dim lr As Long
lr = Sheets("Sheet1").Range("A1").CurrentRegion.Rows.Count
'the lr must be grater then the autofill range
Sheets("Sheet3").Range("A1:B10").AutoFill Destination:=Sheets("Sheet3").Range("A1:B10").Resize(lr), Type:=xlFillDefault
You can also use the With
statement
With Sheets("Sheet3").Range("A1:B10")
.AutoFill Destination:=.Resize(.CurrentRegion.Rows.Count + .CurrentRegion.Rows.Count), Type:=xlFillDefault
End With
'the `.CurrentRegion.Rows.Count' doubles the range for the autofill, you can replace the second one with a specific number e.g. `.CurrentRegion.Rows.Count + 5'