Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Is there a way to reference objects in a VB macro that have been assigned the
same macro? My application involves several different objects in a worksheet used to launch a macro that differs only slightly depending on which object is clicked. If I can ID the object in the code, I can combine the different macros and just include some IF..THEN statements relating to the object clicked. Thx... |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Maybe you can use application.caller to get the name of the object.
Add Msgbox application.caller to the top of your code and you'll see the names you should use to compare. VicWestVan wrote: Is there a way to reference objects in a VB macro that have been assigned the same macro? My application involves several different objects in a worksheet used to launch a macro that differs only slightly depending on which object is clicked. If I can ID the object in the code, I can combine the different macros and just include some IF..THEN statements relating to the object clicked. Thx... -- Dave Peterson |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If the objects are shapes or controls from the control toolbox you can use
application.caller sName = application.caller sName will hold the name of the object. -- Regards, Tom Ogilvy "VicWestVan" wrote: Is there a way to reference objects in a VB macro that have been assigned the same macro? My application involves several different objects in a worksheet used to launch a macro that differs only slightly depending on which object is clicked. If I can ID the object in the code, I can combine the different macros and just include some IF..THEN statements relating to the object clicked. Thx... |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dave...
Your suggestion did exactly what I wanted.... thx much "Dave Peterson" wrote: Maybe you can use application.caller to get the name of the object. Add Msgbox application.caller to the top of your code and you'll see the names you should use to compare. VicWestVan wrote: Is there a way to reference objects in a VB macro that have been assigned the same macro? My application involves several different objects in a worksheet used to launch a macro that differs only slightly depending on which object is clicked. If I can ID the object in the code, I can combine the different macros and just include some IF..THEN statements relating to the object clicked. Thx... -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to reference MSNStockQuote button within a macro | Excel Worksheet Functions | |||
Macro Relative reference button greyed out. | Excel Programming | |||
Recording new excel macro, relative reference button doesn't show | New Users to Excel | |||
relative reference button on end macro menu | Excel Programming | |||
Create button with addin/reference macro in another file | Excel Programming |