Run-time error '1004' : Method 'Range' of object'_worksheet' failed

Captain Bobby 0 Reputation points
2024-07-27T11:06:23.5033333+00:00

I have 2 sheets in my workbook, while source sheet was active, following line work properly, but while target sheet was active, a error message would pop up, like "Run-time error '1004' : Method 'Range' of object'_worksheet' failed"

My COde

Set LifeCraftCodeArea_EPData = Sheet1.Range(Cells(2, Col_LifeCraftCode_EPData), Cells(LastRow_EPData, Col_LifeCraftCode_EPData))

Microsoft 365 and Office Excel For business Windows
{count} votes

1 answer

Sort by: Most helpful
  1. HansV 966 Reputation points MVP
    2024-07-28T15:43:09.0233333+00:00

    Does this work?

    Set LifeCraftCodeArea_EPData = Sheet1.Range(Sheet1.Cells(2, Col_LifeCraftCode_EPData), Sheet1.Cells(LastRow_EPData, Col_LifeCraftCode_EPData))

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.