Button caption toggles whether on or off

General Ledger

Active Member
Joined
Dec 31, 2007
Messages
460
Dear All,

Using Excel 2003, I am looking for a way to have a button where the caption toggles (changes) whether the button is on or off.

I want the caption to read "US Dollars" when the button has not yet been pressed, to read "Canadian Dollars" after the button has been pressed, and to return to "US Dollars" if is pressed again.

I prefer to use an image rather than a command button since they offer more formatting options.

Best regards,

GL
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
General, try:

Code:
Private Sub CommandButton1_Click()
With CommandButton1
    If .Caption = "U.S. Dollars" Then
        .Caption = "Canadian Dollars"
    Else
        .Caption = "U.S. Dollars"
    End If
End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,917
Members
452,366
Latest member
TePunaBloke

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top