I have been using the following formula multiple times with much success in one of my workbooks. But upon making a new one it gives me an error "Run-time error '1004': AutoFill method of Range class failed"
The only difference I can think of so far is I made the macros on excel 2007 and I'm trying to make these new ones on excel 2013... Buuuut my macros made in 07 work perfectly fine in my 13.
This is the code I am using.
Sub SPLI3()
'
' SPLI3 Macro
'
'
Dim lastrow As Long
lastrow = Range("D65000").End(xlUp).Row
Range("C1").Select
ActiveCell.FormulaR1C1 = "=TRIM(CLEAN(SUBSTITUTE(RC[-1],CHAR(160),"" "")))"
Selection.AutoFill Destination:=Range("C1:C" & lastrow)
Range("C1:C5000").Select
End Sub
The debugger Highlights the "Selection.AutoFill Destination:=Range("C1:C" & lastrow)" line.
Any help would be appreciated.
Thanks
The only difference I can think of so far is I made the macros on excel 2007 and I'm trying to make these new ones on excel 2013... Buuuut my macros made in 07 work perfectly fine in my 13.
This is the code I am using.
Sub SPLI3()
'
' SPLI3 Macro
'
'
Dim lastrow As Long
lastrow = Range("D65000").End(xlUp).Row
Range("C1").Select
ActiveCell.FormulaR1C1 = "=TRIM(CLEAN(SUBSTITUTE(RC[-1],CHAR(160),"" "")))"
Selection.AutoFill Destination:=Range("C1:C" & lastrow)
Range("C1:C5000").Select
End Sub
The debugger Highlights the "Selection.AutoFill Destination:=Range("C1:C" & lastrow)" line.
Any help would be appreciated.
Thanks
Last edited: