title: Creating for-loop issue
body: <p>I have a userform with three frames, each frame contains three option buttons which are continiously named meaning: Frame1 = OptionButton 1, 2, 3 / Frame2 = OptionButton 4, 5, 6 / Frame3 = OptionButton 7, 8, 9</p>
  <p>I am trying to create a for loop to search through every frame to check if an option button is true or not and if it is true write the caption of that specific option button into a public variable.</p>
  <p>My code so far</p>
  <pre><code>For i = 1 To 7
  For z = 1 To 20
  
  If UserForm1.Controls(&quot;Frame&quot; &amp; i).Caption = &quot;Amputationstyp&quot; Then
  If UserForm1.Controls(&quot;OptionButton&quot; &amp; z).Value = True Then
      Amputationstyp = UserForm1.Controls(&quot;OptionButton&quot; &amp; z).Caption
  End If
  End If
  
  If UserForm1.Controls(&quot;Frame&quot; &amp; i).Caption = &quot;Amputationsseite&quot; Then
  If UserForm1.Controls(&quot;OptionButton&quot; &amp; z).Value = True Then
      Amputationsseite = UserForm1.Controls(&quot;OptionButton&quot; &amp; z).Caption
  End If
  End If
  
  If UserForm1.Controls(&quot;Frame&quot; &amp; i).Caption = &quot;Restgliedstabilität&quot; Then
  If UserForm1.Controls(&quot;OptionButton&quot; &amp; z).Value = True Then
      Restgliedstabilität = UserForm1.Controls(&quot;OptionButton&quot; &amp; z).Caption
  End If
  End If
  
  If UserForm1.Controls(&quot;Frame&quot; &amp; i).Caption = &quot;Restgliedform&quot; Then
  If UserForm1.Controls(&quot;OptionButton&quot; &amp; z).Value = True Then
      Restgliedform = UserForm1.Controls(&quot;OptionButton&quot; &amp; z).Caption
  End If
  End If
  
  If UserForm1.Controls(&quot;Frame&quot; &amp; i).Caption = &quot;Knochenauswüchse&quot; Then
  If UserForm1.Controls(&quot;OptionButton&quot; &amp; z).Value = True Then
      Knochenauswüchse = UserForm1.Controls(&quot;OptionButton&quot; &amp; z).Caption
  End If
  End If
  
  If UserForm1.Controls(&quot;Frame&quot; &amp; i).Caption = &quot;Hautkrankheiten (am Stumpf)&quot; Then
  If UserForm1.Controls(&quot;OptionButton&quot; &amp; z).Value = True Then
      Hautkrankheiten = UserForm1.Controls(&quot;OptionButton&quot; &amp; z).Caption
  End If
  End If
  
  If UserForm1.Controls(&quot;Frame&quot; &amp; i).Caption = &quot;Muskeltonus&quot; Then
  If UserForm1.Controls(&quot;OptionButton&quot; &amp; z).Value = True Then
      Muskeltonus = UserForm1.Controls(&quot;OptionButton&quot; &amp; z).Caption
  End If
  End If
  Next
  Next
  </code></pre>
  <p>The problem: I tried to check for the frame caption and only write something in the variable when this condition is met, but the condition is also met, when Option button three is getting checked which then leads to a wrong values in all of the variables. The first if statement doesnt work as it is.</p>