I have a formula that loops through the checkboxes and places the captions as consecutive strings separated by a comma in the next column. I need to modify it so that each checkbox that is true is input on a separate row
VBA Code:
Private Sub CommandButton1_Click()
Dim ans As String
Dim emptyrow As Long
For Each xcontrol In Me.Controls
If TypeName(xcontrol) = "CheckBox" Then
If xcontrol.Value = True Then ans = ans & xcontrol.Caption & "," & " "
End If
Next xcontrol
If ans = "" Then
MsgBox "You selected no CheckBoxes"
Else
ActiveCell.Offset(0, 1).Value = Left(ans, Len(ans) - 1)
End If
Unload Me
End Sub