ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Wild Ideas (https://www.excelbanter.com/excel-programming/303974-wild-ideas.html)

No Name

Wild Ideas
 
Is it possible to change the caption on a command button
(in excel/vba) when a user clicks the button to say
something different.

Rob Bovey

Wild Ideas
 
wrote in message
...
Is it possible to change the caption on a command button
(in excel/vba) when a user clicks the button to say
something different.


Private Sub CommandButton1_Click()
Static lCount As Long
If lCount Mod 2 Then
CommandButton1.Caption = "Click Me Once"
Else
CommandButton1.Caption = "Click Me Again"
End If
lCount = lCount + 1
End Sub

--
Rob Bovey, MCSE, MCSD, Excel MVP
Application Professionals
http://www.appspro.com/

* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *





All times are GMT +1. The time now is 03:16 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com