LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
LPS LPS is offline
external usenet poster
 
Posts: 108
Default How to pass the name of the cmdbutton calling an Excel VBA pro

Excellent, it works!

Thank you --- I would have never thought of referring to Shapes.

---------

"Ron de Bruin" wrote:

Hi LPS

Use forms buttons and attach this macro to all of them

Sub test()
MsgBox ActiveSheet.Shapes(Application.Caller).Name
End Sub



--
Regards Ron de Bruin
http://www.rondebruin.nl



"LPS" wrote in message ...
I would like to have multiple command buttons call a single procedure and
that procedure displays a msgbox that shows the name of the button which
called it.

Can anyone help with the correct code? I've tried several things that have
not worked. The only solution I came up with is having the 'click' method of
the buttons call the single procedure and pass the name as a variable. the
problem with this if I expland the scenario to 20+ command buttons, there is
a lot of excess 'click' method code which seems redundant.

Thanks in advance for any help.






 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
CmdButton on worksheet1 missing pdavis Excel Discussion (Misc queries) 0 August 2nd 06 08:01 PM
While sheet is protected, allow cmdButton to refresh query. mhng Excel Programming 2 July 17th 06 05:54 PM
Add to CmdButton oberon.black[_43_] Excel Programming 0 September 11th 05 11:45 PM
How to pass a variable from Form back to calling procedure John[_111_] Excel Programming 4 August 21st 05 03:54 PM
hide/unhide cell when clicking a cmdbutton harder1216 Excel Programming 1 October 11th 04 05:09 PM


All times are GMT +1. The time now is 02:28 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"