KungFu Keyboard
New Member
- Joined
- Oct 22, 2016
- Messages
- 26
Hi there,
I am creating a macro that requires a formula to be auto-filled across the spreadsheet to the last column with data in it. The number of columns varies. I have tried the following:
Dim LastColumn As Long
Range("Q3").Select
ActiveCell.FormulaR1C1 = "=IFERROR(SEARCH(R2C,RC4,1),0)"
LastColumn = Cells(3, Columns.Count).End(xlToLeft).Column
Range("Q3").AutoFill Destination:=Range(Range("Q3"), Cells(3, LastColumn)), Type:=xlFillFormats
Error message as follows: "runtime error 1004 autofill method of range class failed"
Regards,
Bernard
I am creating a macro that requires a formula to be auto-filled across the spreadsheet to the last column with data in it. The number of columns varies. I have tried the following:
Dim LastColumn As Long
Range("Q3").Select
ActiveCell.FormulaR1C1 = "=IFERROR(SEARCH(R2C,RC4,1),0)"
LastColumn = Cells(3, Columns.Count).End(xlToLeft).Column
Range("Q3").AutoFill Destination:=Range(Range("Q3"), Cells(3, LastColumn)), Type:=xlFillFormats
Error message as follows: "runtime error 1004 autofill method of range class failed"
Regards,
Bernard