Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,311
Default Return caption of unknown button into a cell

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Return caption of unknown button into a cell

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
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
Unknown error in function, and how to return value? Chris Excel Worksheet Functions 3 May 22nd 09 01:59 AM
How to set up caption on a button at startup? [email protected] Excel Programming 6 November 21st 07 11:01 PM
return .caption text of worksheet control Susan Excel Programming 2 May 4th 07 02:43 PM
Place the caption of a toggle button into a cell [email protected] Excel Worksheet Functions 2 May 12th 05 04:47 AM
Caption of a button Dr_Phil Excel Programming 4 May 4th 04 09:13 PM


All times are GMT +1. The time now is 08:56 AM.

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"