fhzhkunming
New Member
- Joined
- Mar 4, 2021
- Messages
- 30
- Office Version
- 365
- Platform
- Windows
Hi All,
I want to autofill series numbers in column F. Basically, F2 = 1, F3=2..., the length of the series depends on row numbers of Column G (Fig).
Here is my code, but I got run-time error 1004': Application-defined or object-defined error, which I can't figure out. Could someone help me out?
Thanks
I want to autofill series numbers in column F. Basically, F2 = 1, F3=2..., the length of the series depends on row numbers of Column G (Fig).
Here is my code, but I got run-time error 1004': Application-defined or object-defined error, which I can't figure out. Could someone help me out?
VBA Code:
Sub Autofill_seriers()
Dim Lrow As Long
Lrow = Range("G2:G" & Rows.Count).End(xlUp).Row
With Sheets("Lat Longs-2")
Range("F2").Value = 1
Range("F3").Value = 2
Range("F2:F3").AutoFill Destination:=.Range("F2:F" & Lrow) 'run-time error '1004'
End With
End Sub
Thanks