Good evening,
I have the following code in a userform to automatically take what the operator has selected from a choice of checkboxes and puts the caption value in a textbox. However I have other checkboxes in the userform and it is picking up all of the checkboxes. Is there a way to make it only pick up the captions of check boxes that are within its own frame and not the entire userform. The frame where the checkboxes are located is called CallSign.
I attempted to use a "Replace" however it did not work
Thank you for any help
I have the following code in a userform to automatically take what the operator has selected from a choice of checkboxes and puts the caption value in a textbox. However I have other checkboxes in the userform and it is picking up all of the checkboxes. Is there a way to make it only pick up the captions of check boxes that are within its own frame and not the entire userform. The frame where the checkboxes are located is called CallSign.
Code:
Private Sub WriteToTextBox()
'Call Sign Textbox
Dim c As Control
Dim s As String
For Each c In Me.Controls 'Loop through all controls
If TypeName(c) = "CheckBox" Then 'Ensure control is a checkbox
If c.Value = True Then 'We know it's a checkbox so check if it has been ticked
s = IIf(s = "", c.Caption, s & ", " & c.Caption) 'Populate the string variable
' Me.txcallsign.Text.Replace("Protective Services Staff Dispatched", "").Trim()
End If
End If
Next c
frcallsign.txcallsign = s 'write string to textbox
End Sub
I attempted to use a "Replace" however it did not work
Thank you for any help