Range activation when a worksheet is activated

Gavin T

Well-known Member
Joined
Mar 26, 2014
Messages
836
Hey guys,

When a user activates a worksheet, excel reactivates the range that was last active when the worksheet was deactivated (sounds more confusing that what I'm trying to say.) I'd like to know, is there some property of the Worksheet object that stores the information of that range or, somehow a way to programmatically change that range? I'm trying to somehow set which range would activate upon worksheet activation - without using worksheet events or activating the worksheet itself.

I haven't come across any mention of this anywhere and I don't know if this is possible via vba.

Thanks for any ideas :)
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
That is exactly what worksheet events are for, why are you trying to avoid them??
 
Upvote 0
It's more of an academic question. But either way using a worksheet event wouldn't really solve what I'm thinking about. I have many codes that works on worksheets (without activating them) but leaves the range selected in a way I don't want. I could just have all my code go through each worksheet, activate it, and select the desired range but seems like there should be a faster and better way.
 
Upvote 0
Why do you need to select a range in your code? it is usually possible to avoid selecting ranges in VBA, and the reason for avoiding selecting ranges is to avoid exactly the problem you have come up with
 
Upvote 0
I am reapplying a sort on a table on another sheet. Which automatically selects the entire table.

VBA Code:
wsCompleted.ListObjects("tSummary").Sort.Apply
 
Upvote 0
Ok I understand the problem, I think you are left with reselecting the correct range after it.
 
Upvote 0

Forum statistics

Threads
1,214,819
Messages
6,121,737
Members
449,050
Latest member
excelknuckles

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top