Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Is there a way to capture the caption information of a CommandButton that
was just pressed without knowing the name of the CommandButtonand? I'd like to be able to press a command button (any CommandButton) and have the caption from that button displayed in, say AA1? Is there some sort of "ActiveCommandButton" code? Range("AA1").Value= CaptionOfButtonJustPressed Is this possible? Paul -- |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You would have to put the appropriate code in the Click event for each
CommandButton that you want to have this feature... there is no general overall event (at least not that I am aware of) that can monitor when a random CommandButton is clicked. Something like this should work... Private Sub CommandButton1_Click() Range("AA1").Value = CommandButton1.Caption End Sub Private Sub CommandButton2_Click() Range("AA1").Value = CommandButton2.Caption End Sub Private Sub CommandButton3_Click() Range("AA1").Value = CommandButton3.Caption End Sub -- Rick (MVP - Excel) "PCLIVE" wrote in message ... Is there a way to capture the caption information of a CommandButton that was just pressed without knowing the name of the CommandButtonand? I'd like to be able to press a command button (any CommandButton) and have the caption from that button displayed in, say AA1? Is there some sort of "ActiveCommandButton" code? Range("AA1").Value= CaptionOfButtonJustPressed Is this possible? Paul -- |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Unknown error in function, and how to return value? | Excel Worksheet Functions | |||
How to set up caption on a button at startup? | Excel Programming | |||
return .caption text of worksheet control | Excel Programming | |||
Place the caption of a toggle button into a cell | Excel Worksheet Functions | |||
Caption of a button | Excel Programming |