R
Robert Crandal
The following code generates an error in Line 5
Sheets("APR").Select
Rows("9:9").Select
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Sheets("Data").Select
Rows("25:25").Select ' Line 5 - Error happens here
Selection.Copy
Sheets("APR").Select
ActiveSheet.Paste
The error code is 400. The error description is "Select method
of Range class failed". I'm not sure why this error is occurring,
especially since the above code was generated by Excel's
"Record Macro" function.
Why would the above code work during "Record Macro",
but it generates an error when I run it from VBA code?
I basically have a button on my "APR" spreadsheet that calls
the above code.
Anybody know what's going on here?
Sheets("APR").Select
Rows("9:9").Select
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Sheets("Data").Select
Rows("25:25").Select ' Line 5 - Error happens here
Selection.Copy
Sheets("APR").Select
ActiveSheet.Paste
The error code is 400. The error description is "Select method
of Range class failed". I'm not sure why this error is occurring,
especially since the above code was generated by Excel's
"Record Macro" function.
Why would the above code work during "Record Macro",
but it generates an error when I run it from VBA code?
I basically have a button on my "APR" spreadsheet that calls
the above code.
Anybody know what's going on here?