title: VBA Looping through checkboxes and getting its name from excel table
body: <p><a href="https://i.stack.imgur.com/THXjK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/THXjK.png" alt="Image1" /></a></p>
  <p><a href="https://i.stack.imgur.com/dsfXL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dsfXL.png" alt="enter image description here" /></a></p>
  <p>As you can see above, I have a table in a Excel sheet where indication A can have product 1, product 2 and so forth (The prods names are all different depending on the indication, this is just for simplicity!).</p>
  <p>In my userform a similar format is presented. I want to basically match the indication name on my excel sheet with the indication name in my userform. If they match, then Product 11 gets A's Prod 1 name, Product 12 gets A's Prod 2 name and so forth.</p>
  <p>I've tried the following, but I'm just starting using VBA so I'm sure it probably doesn't even make sense.</p>
  <pre><code>
  Dim code_ind As String
  Dim sel_ind As String
  Dim chkbx As Control
  Dim labx As Control
  Dim i As Integer
  Dim col_value As Integer
  Dim row_value As Integer
  
  For i = 1 To 8
  For j = 1 To 4
  For row_value = 4 To 11
  col_value = 0
  
  Set chkbx = Me.Controls(&quot;seg_l_selInd_&quot; &amp; i)
  Set labx = Me.Controls(&quot;seg_cb_selInd_&quot; &amp; i &amp; j)
  
  sel_ind = tWb.Worksheets(&quot;LALALA&quot;).Columns(2).Find(what:=chkbx)
  
  If code_ind = sel_ind Then
      labx.Name = tWb.Worksheets(&quot;LALALA&quot;).Cells(row_value, 3 + col_value)
      col_value = col_value + 1
  End If
  Next row_value
  Next j
  Next i
  </code></pre>
  <p>Is there any way I can do this? I know I could just write the names manually, but I need my tool to be as flexible as possible. Ideally, if more information is added into the excel table, the userform will automatically update.</p>