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

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
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,215,353
Messages
6,124,463
Members
449,163
Latest member
kshealy

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