title: Loop through checkboxes to see which ones are checked
body: <p>I have a userform that contains 10x check boxes.</p>
  
  <p>Each of these check boxes should have a value. Say check box 1 should contain value "Medicine", check box 2 should contain value "Water".</p>
  
  <p>I am giving the users the option to check any of these and press submit. On pressing submit, I would like to check which check boxes were ticked and combine the values.</p>
  
  <p>I.e. if user ticks only check box 1 and 2, then the output will be "MedicineWater".</p>
  
  <p>Rather than doing 10 nested IF statements and then doing all the possible permutations, which would take very long. I wonder if it is possible to loop through the check boxes and see which one is ticked (marked as True) and then store the value that should be assigned to it.</p>
  
  <p>My simplified code is:</p>
  
  <pre><code>Private Sub Submit_Click()
  Dim i as Long
  Dim Val1 as String
  Dim Val2 as String
  Dim Array()
  Dim Final as String
  
  Val1 = "Medicine"
  Val2 = "Water"
  
  For i = 1 to 2
     If Me.CheckBox &amp; i  = True Then
        Array = Val &amp; i
        Final = Join(Array, "")
     End If
  Next i
  
  Msgbox (Final)
  End Sub
  </code></pre>
  
  <p>Can someone please advise me how to do this properly?</p>
  
  <p>Thanks</p>