title: How to allow only one ToggleButton to be ON at a time in Excel
body: <p>I have created a UserForm in excel 2010 and put 10 toggle button in it.When I run the form all of them can be ON (value = TRUE) but I want only one of them to be ON at the same time.Like below:</p>
  
  <p>In A Class Module</p>
  
  <pre><code>Public WithEvents ToggleGroup As ToggleButton 
  
  Private Sub ToggleGroup_click() 
  
  ' code
  
  End Sub 
  </code></pre>
  
  <p>In a UserForm</p>
  
  <pre><code>Dim Buttons() As New Class1 
  
  Private Sub UserForm_Initialize() 
  
      Dim ToggleCount     As Integer 
      Dim Ctl             As Control 
  
      For Each Ctl In UserForm1.Controls 
          If TypeName(Ctl) = "ToggleButton" Then 
              ReDim Preserve Buttons(1 To ToggleCount) 
              Set Buttons(ToggleCount).ToggleGroup = Ctl 
          End If 
      Next Ctl 
  
  End Sub
  </code></pre>
  
  <p>In a Module</p>
  
  <pre><code>Sub Form()
  UserForm1.Show
  End Sub
  </code></pre>