Giordano Bruno
Well-known Member
- Joined
- Jan 7, 2007
- Messages
- 1,356
lngCol = 5, lngEndCol = 9
the line of code
Sheets("strCols").Range(Cells(2, lngCol), Cells(2, lngEndCol)).Copy
fails with a Run-time error 1003 Application-defined or object-defined error
the alternative
Sheets("strCols").Range("E2:I2").Copy
works fine.
If Sheet("strCols") is active at the time the first line of code is read, there is no problem, but I do not want to activate the sheet just for this line of code.
Does anyone have an idea what may be happening?
the line of code
Sheets("strCols").Range(Cells(2, lngCol), Cells(2, lngEndCol)).Copy
fails with a Run-time error 1003 Application-defined or object-defined error
the alternative
Sheets("strCols").Range("E2:I2").Copy
works fine.
If Sheet("strCols") is active at the time the first line of code is read, there is no problem, but I do not want to activate the sheet just for this line of code.
Does anyone have an idea what may be happening?