I'm not an experienced VBA programmer and need someone's help. The code
below comes from a recorded macro, with some ideas from the VBA help files,
and I've attempted to modify it to be more generic and not associated with a
specific row or sheet.
After modifying a cell's formula to reflect a new sheet name, I'm attempting
to copy it across several columns, as follows (newRow is Dim'ed as an
integer and is valid when I run the code):
newFormula = "='" & sheetName & "'!K$2"
Cells(newRow, 4).formula = newFormula
ActiveSheet.Cells(newRow, 4).Select
Selection.AutoFill Destination:=Range(Cells(newRow, 5), Cells(newRow,
9)), Type:=xlFillDefault
I get a run-time error 1004 - Autofill method of Range class failed. If I
debug the code and hover the cursor over the various elements, I get
"Cells(newRow, 5)=Error 2023".
What am I doing incorrectly and where can I find the definitions of the
reported error codes? I've searched help and searched the MS website
without success.
TIA
DJM
Bookmarks