Togglebutton as Option

Dossfm0q

Banned User
Joined
Mar 9, 2009
Messages
570
Office Version
  1. 2019
Platform
  1. Windows
I have Excel Sht. Has Ribbon 6 Togglebuttons
I need when Press ="True" One of then the other get opposite Press="False"
Thx
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Something like this:

Code:
Private Sub ToggleButton1_Click()
  If Me.ToggleButton1.Value Then
    Call ToggleOthers(1)
  End If
End Sub

Private Sub ToggleButton2_Click()
  If Me.ToggleButton2.Value Then
    Call ToggleOthers(2)
  End If
End Sub

Private Sub ToggleButton3_Click()
  If Me.ToggleButton3.Value Then
    Call ToggleOthers(3)
  End If
End Sub

Private Sub ToggleButton4_Click()
  If Me.ToggleButton4.Value Then
    Call ToggleOthers(4)
  End If
End Sub

Private Sub ToggleButton5_Click()
  If Me.ToggleButton5.Value Then
    Call ToggleOthers(5)
  End If
End Sub

Private Sub ToggleButton6_Click()
  If Me.ToggleButton6.Value Then
    Call ToggleOthers(6)
  End If
End Sub

Private Sub ToggleOthers(Index As Integer)
  Dim i As Integer
  Application.EnableEvents = False
  For i = 1 To 6
    If i <> Index Then
      Me.OLEObjects("ToggleButton" & i).Object.Value = False
    End If
  Next i
  Application.EnableEvents = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,226,114
Messages
6,189,052
Members
453,522
Latest member
Seeker2025

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