Hi, I have a userform that populates checkboxes dynamically based on a user list on one of my worsheets. I'd like to send an email to all of the users where the checkbox = true. How do I associate an email with each of the checkboxes?
Further info:
The user list is in column A and their associated email is in column E
Thanks!
Further info:
The user list is in column A and their associated email is in column E
Thanks!
Code:
Private Sub UserForm_Initialize()
Dim curColumn As Long
Dim LastRow As Long
Dim i As Long
Dim chkBox As MSForms.CheckBox
Dim ctrl As Control
curColumn = 1 'Set your column index here
LastRow = Worksheets("sht_data").Cells(Rows.Count, curColumn).End(xlUp).Row
For i = 5 To LastRow
Set chkBox = Me.Controls.Add("Forms.CheckBox.1", "CheckBox_" & i)
chkBox.Caption = Worksheets("sht_data").Cells(i, curColumn).Value
chkBox.Left = 5
chkBox.Top = 5 + ((i - 1) * 20)
Next i
For Each ctrl In Me.Controls
If TypeName(ctrl) = "CheckBox" Then
ctrl.Value = True
End If
Next ctrl
End Sub