ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Changing text on a button (https://www.excelbanter.com/excel-discussion-misc-queries/151878-changing-text-button.html)

Brad

Changing text on a button
 
Can you have two different texts on a button?

If the user clicks the button - I would like it to say - "Showing Summary"

If the user makes a change to the spreadsheet - I would like it to say -
"Click for Summary pages"

BigPig

Changing text on a button
 
Hi Brad,

Yes. You would have to do it via vba though.

A few things,
1. Relabel the commandbutton to cmdshowsum, or keep the one you have but
don't forget to change all the references in the code.
2. I used worksheet1 for this example, if you are using a different one be
sure to change 1 to whatever
3. Right click the sheet tab, view code, and paste the following.

Private Sub cmdshowsum_Click()

cmdshowsum.Caption = "Showing Summary"

End Sub

Private Sub Worksheet_Change(ByVal Target As Range)

Dim csp As String
csp = "Click for Summary Pages"

With Worksheets(1)
cmdshowsum.Caption = csp
End With

End Sub


hth

BigPig

challa prabhu

Changing text on a button
 
Hi,

This can be done using VBA programming environment built in Microsoft Excel.
You can do this by knowing if there is a change event which has occured.
Preferably changing a image would be convinient than changing text button.

Challa Prabhu

"Brad" wrote:

Can you have two different texts on a button?

If the user clicks the button - I would like it to say - "Showing Summary"

If the user makes a change to the spreadsheet - I would like it to say -
"Click for Summary pages"



All times are GMT +1. The time now is 04:21 AM.

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