I'm trying a simple macro, and am not sure why I'm getting an error. The macro is below.
Sub DoWPR()
'This one is specific to "TodaysWPR.xls"; Replaces blanks in Justification column with line Descriptions
Dim LastRow As Long
LastRow = Range("A" & Rows.Count).End(xlUp).Row 'this tells where our last row is
Columns("X:Z").NumberFormat = "General"
Range("Z1:Z" & LastRow).FormulaR1C1 = "=IF(ISTEXT(RC[-2]),RC[-2],RC[-21])"
Columns("X:X").Value = Columns("Z:Z").Value
Columns("Z:Z").ClearContents
End Sub
The error occurs when trying to copy the value from column Z into column X. Besides the "Columns" method above, I've also tried using
Range("X1:X" & LastRow).value =Range("Z1:Z" & LastRow).value
Both ways I get a runtime 1004, Application Defined or Object defined error.
The macro lives in my Personal.xls, and I'm running it on TodaysWPRs.xls. Do I need to declare a sheet name or anything? The first two lines work just fine.
Bookmarks