Get non active worksheet name by mouse click excel 2007 VBA

Phrayzur

New Member
Joined
Nov 4, 2012
Messages
2
I'm new to this (actually any) forum. So please bear with me...

The problem I have is:

In a workbook I have a calculation sheet and worksheets that contain the data to calculate named in a "mm-dd-yyyy" format. When I switch to a different day I have a macro that prompts me for the worksheet name. I need to get the worksheet name that I want to switch to by clicking on the worksheet tab.

I can't for the life of me figure it out...

Any help would be appreciated.
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
You could list the worksheet names in an InputBox and prompt the user to enter the number:

Select a sheet:
1. Bob
2. Joe
3. Bill
 
Upvote 0
That's a good idea. Actually, that's a great idea! Thanks!

I wonder how you'd do the other tho...
 
Upvote 0
You could set a public Boolean ("bLooking"). Instead of an InputBox, display a modeless userform. In the SheetActivate event, check if the Boolean is true, and if so, set a public Worksheet variable, close the userform, clear the Boolean, and kick off the rest of the code.
 
Upvote 0

Forum statistics

Threads
1,214,643
Messages
6,120,702
Members
448,980
Latest member
CarlosWin

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