Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 207
Default Toggle buttons

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 772
Default Toggle buttons

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   Report Post  
Posted to microsoft.public.excel.programming
Ray Ray is offline
external usenet poster
 
Posts: 267
Default Toggle buttons

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 207
Default Toggle buttons

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
have toggle buttons but everytime print preview buttons move TinSandhu Excel Discussion (Misc queries) 1 October 11th 06 02:57 PM
Toggle Buttons Bill Excel Programming 1 May 16th 06 06:44 PM
Toggle command buttons GEB Excel Programming 4 June 23rd 05 08:33 PM
Toggle Buttons Momo Excel Programming 2 February 9th 05 01:35 PM
multiple toggle buttons Nelson Excel Programming 3 November 2nd 04 08:27 AM


All times are GMT +1. The time now is 11:23 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"