Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
To All,
I have a spreadsheet that I have added togglebuttons to (5). Can someone help me with the proper program to: If togglebutton1 is selected, it will unselect the other toggle buttons. Thanks for the help. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Just double click them and turn the others off in code, there are prettier
ways but they are harder to understand: Private Sub ToggleButton1_Click() If ToggleButton1 = True Then ToggleButton2 = False ToggleButton3 = False ToggleButton4 = False ToggleButton5 = False End If End Sub Private Sub ToggleButton2_Click() If ToggleButton2 = True Then ToggleButton1 = False ToggleButton3 = False ToggleButton4 = False ToggleButton5 = False End If End Sub Private Sub ToggleButton3_Click() If ToggleButton3 = True Then ToggleButton1 = False ToggleButton2 = False ToggleButton4 = False ToggleButton5 = False End If End Sub Private Sub ToggleButton4_Click() If ToggleButton4 = True Then ToggleButton1 = False ToggleButton2 = False ToggleButton3 = False ToggleButton5 = False End If End Sub Private Sub ToggleButton5_Click() If ToggleButton5 = True Then ToggleButton1 = False ToggleButton2 = False ToggleButton3 = False ToggleButton4 = False End If End Sub -- -John Please rate when your question is answered to help us and others know what is helpful. "FloMM2" wrote: To All, I have a spreadsheet that I have added togglebuttons to (5). Can someone help me with the proper program to: If togglebutton1 is selected, it will unselect the other toggle buttons. Thanks for the help. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'm not 100% sure this is correct ... I'm sure someone else 'smarter'
will correct me ... :) The nature of toggle buttons is that if you have multiple on your sheet, selecting one automatically de-selects the others -- if not, you may not be using 'toggle buttons'. They should be round, with a little black circle in them when selected. As for how to code them, you can use this basic template (by Tom Ogilvy): Private Sub ToggleButton1_Click() If ToggleButton1.Value = True Then MsgBox "depressed" ' or your code here' Else MsgBox "Not depressed"' ' or your code here' 'etc,etc,etc.... End If End Sub |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
John,
Thank you soooooo much. I have been sending a lot of time tweaking this to try and get it. You hit it out of the park, thank you. Dennis "John Bundy" wrote: Just double click them and turn the others off in code, there are prettier ways but they are harder to understand: Private Sub ToggleButton1_Click() If ToggleButton1 = True Then ToggleButton2 = False ToggleButton3 = False ToggleButton4 = False ToggleButton5 = False End If End Sub Private Sub ToggleButton2_Click() If ToggleButton2 = True Then ToggleButton1 = False ToggleButton3 = False ToggleButton4 = False ToggleButton5 = False End If End Sub Private Sub ToggleButton3_Click() If ToggleButton3 = True Then ToggleButton1 = False ToggleButton2 = False ToggleButton4 = False ToggleButton5 = False End If End Sub Private Sub ToggleButton4_Click() If ToggleButton4 = True Then ToggleButton1 = False ToggleButton2 = False ToggleButton3 = False ToggleButton5 = False End If End Sub Private Sub ToggleButton5_Click() If ToggleButton5 = True Then ToggleButton1 = False ToggleButton2 = False ToggleButton3 = False ToggleButton4 = False End If End Sub -- -John Please rate when your question is answered to help us and others know what is helpful. "FloMM2" wrote: To All, I have a spreadsheet that I have added togglebuttons to (5). Can someone help me with the proper program to: If togglebutton1 is selected, it will unselect the other toggle buttons. Thanks for the help. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
have toggle buttons but everytime print preview buttons move | Excel Discussion (Misc queries) | |||
Toggle Buttons | Excel Programming | |||
Toggle command buttons | Excel Programming | |||
Toggle Buttons | Excel Programming | |||
multiple toggle buttons | Excel Programming |