Toggel Button

0 Agios

Well-known Member
Joined
Feb 22, 2004
Messages
570
Office Version
  1. 365
I am using 6 toggle buttons, if all are pressed, then a mesage box appers with the words "All Ok"
Help, its Sunday I need to go to the Zoo with the kids :)
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
When a ToggleButton is pressed, it's value will be -1, otherwise 0.
So if the sum of your 6 ToggleButtons is -6, then you know
they are all pressed.

The code could look like this...
Code:
Private Function areAllPressed() As Boolean
    areAllPressed = -6 = ToggleButton1 + ToggleButton2 + ToggleButton3 _
        + ToggleButton4 + ToggleButton5 + ToggleButton6
End Function

Private Sub ToggleButton1_Click()
    If areAllPressed Then MsgBox "All OK"
End Sub

Private Sub ToggleButton2_Click()
    If areAllPressed Then MsgBox "All OK"
End Sub

'repeat for each toggle button

Looks like it's getting late in Florida - I hope you made it to the Zoo with the kids! :)
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,283
Members
452,902
Latest member
Knuddeluff

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