Dazzawm
Well-known Member
- Joined
- Jan 24, 2011
- Messages
- 3,748
- Office Version
- 365
- Platform
- Windows
I have recorded the macro below that autofills and for use on future files. The problem is that the amount of rows will increase each time but if I use the recorded macro it will not fill all rows only to B16342. What can I change so it autofills all the rows in each file going forwards?
What it needs to do is put the number of rows in column A in this case 1 to 16342 and put number 1 in each cell in column B, both starting in row 2. Thanks.
What it needs to do is put the number of rows in column A in this case 1 to 16342 and put number 1 in each cell in column B, both starting in row 2. Thanks.
Code:
Range("A2").Select
ActiveCell.FormulaR1C1 = "1"
Range("A3").Select
ActiveCell.FormulaR1C1 = "2"
Range("B2").Select
ActiveCell.FormulaR1C1 = "1"
Range("B3").Select
ActiveCell.FormulaR1C1 = "1"
Range("A2:B3").Select
Selection.AutoFill Destination:=Range("A2:B16342"), Type:=xlFillDefault
Range("A2:B16342").Select
Range("A1").Select