Select cell on inactive sheet

User avatar
Rudi
gamma jay
Posts: 25455
Joined: 17 Mar 2010, 17:33
Location: Cape Town

Select cell on inactive sheet

Post by Rudi »

Is there a way to select a cell on an inactive sheet?
IF I am on another sheet and run the code below, it debugs on the select line. I don't need to select the cell, but I do want to move to A1 so when the sheet is selected it shows A1 active.
I could do it with a sheet_activate event, but I would like to avoid events if possible.
Any other way to do it?
TX

Code: Select all

Sub ClearStaffCosts()
      Worksheets("StaffCosts").Rows("2:1000").Delete
      Worksheets("StaffCosts").Range("A1").Select
End Sub
Regards,
Rudi

If your absence does not affect them, your presence didn't matter.

User avatar
HansV
Administrator
Posts: 78524
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Select cell on inactive sheet

Post by HansV »

No, you can only select a cell on the currently active sheet. What objection do you have to using the Worksheet_Activate event?
Best wishes,
Hans

User avatar
Rudi
gamma jay
Posts: 25455
Joined: 17 Mar 2010, 17:33
Location: Cape Town

Re: Select cell on inactive sheet

Post by Rudi »

No objection to the event...
I was simply trying to keep all the code grouped to on standard module. Silly I suppose if the functionality is there...but i just wanted to confirm.
TX.
Regards,
Rudi

If your absence does not affect them, your presence didn't matter.