VBA Code to Identify Selected Shape

MinionKi

Board Regular
Joined
May 13, 2016
Messages
80
You can assign a macro to pretty much any object in excel. My question is if when selecting an object that has a macro attached to it if you can have the Macro first identify which shape you have clicked.

For example if I were to click on "Object1" and the code that runs when I select "Object1" says if this is "Object1" then do "..." Else do "..."

Let me know if this isn't clear enough.

Thanks.
 
Last edited:

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Application.Caller is exactly what I was looking for. Thank you. I ended up finding this property while running through someone else's code and it worked like a charm.
 
Upvote 0
Before offering advice on this forum, please learn Excel and VBA. "Application.Caller" does not apply to ActiveX controls (buttons).
I truly wish the dilettanti would leave the field to the professionals.

At this point neither I, nor as far as I know, anyone else had figured a way to get the name of an ActiveX button without cycling (which involves KNOWING its name in advance.

I need to her the trailing number of "tbnLong56", when I do not know which "tbnLong**" was pressed

Good luck in your excel endeveaours
 
Upvote 0

Forum statistics

Threads
1,223,646
Messages
6,173,536
Members
452,520
Latest member
Pingaware

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