Changing text on a button

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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"
 
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
 
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
 
Back
Top