Error 1004 on VBA operation
On Mar 20, 5:21 am, N L wrote:
Hello, folks. I'm getting an error : "Run-time error '1004':
Application-defined or object-defined error" when I get to the
following line:
Set ActualsActualsRange = ActiveWorkbook.Worksheets("Actuals-
Sheet").Range(Cells(5, 12), Cells(5, 500))
Any idea what's wrong with this? It looks like a properly-formed
range, and pretty explicitly referenced.
Thanks,
N L
Hi NL,
try...
With ActiveWorkbook.Worksheets("Actuals-Sheet")
Set ActualsActualsRange = .Range(.Cells(5, 12), .Cells(5, 500))
End With
Cells assumes ActiveWorksheet so you needed to preface the Cells with
the applicable worksheet name. This is most efficiently done with a
With/End With.
Don't miss the "." before each Cells.
Ken Johnson
|