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

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
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,214,646
Messages
6,120,717
Members
448,985
Latest member
chocbudda

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