mellymelle
New Member
- Joined
- Nov 25, 2016
- Messages
- 45
Have a block of code that utilized .AutoFill several times. One of them returned a run-time error 1004 autofill method of range class failed. Couldn't for the life of me figure out why the other autofill codes weren't generating errors when they were in the exact same format (and were executing on the workbook - formulas were filled down as coded), so gave up and used copy paste instead on the code generating the error. The next run, another autofill code line that was executing fine before turned up a 1004 error. I didn't change the line in question at all, why would it work before and not now?
Here's a sample of the code, the original autofill line is included (but commented out) for illustration:
My workaround is working fine, but I'm perplexed. Please share your thoughts, thanks in advance.
Here's a sample of the code, the original autofill line is included (but commented out) for illustration:
Code:
Sheet3.Columns("A:A").Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Sheet3.Range("A1").Formula = "Account #"
Sheet3.Range("A2").Formula = "=LEFT(TRIM(RC[8]),3) & MID(TRIM(RC[8]),5,4) & RIGHT(TRIM(RC[8]),1)"
If ALastRow > 2 Then
Sheet3.Range("A2").Copy Sheet3.Range("A3:A" & ALastRow)
' Sheet3.Range("A2").AutoFill Destination:=Range("A2:A" & ALastRow), Type:=xlFillDefault
End If
Last edited: