Hi,
I have a listbox that is populated based on usernames listed in cells A5-A24. Each username has a checkbox, if the checkbox is selected, I need to send an email with an attachment to that user. I have each of the associated emails listed in column F.
The macro I have first creates and saves a separate Excel file for each employee, then the user will open the userform (listbox) and select to which employees an email will be sent. Upon selecting employees and hitting "Send", an email will be sent to each employee with their respective attached file.
I can't seem to wrap my head around a way to associate each checked box with the email address to send to. This is my basic code so far....
Any help would be greatly appreciated.
Kind regards
I have a listbox that is populated based on usernames listed in cells A5-A24. Each username has a checkbox, if the checkbox is selected, I need to send an email with an attachment to that user. I have each of the associated emails listed in column F.
The macro I have first creates and saves a separate Excel file for each employee, then the user will open the userform (listbox) and select to which employees an email will be sent. Upon selecting employees and hitting "Send", an email will be sent to each employee with their respective attached file.
I can't seem to wrap my head around a way to associate each checked box with the email address to send to. This is my basic code so far....
Code:
Private Sub CommandButton1_Click()
For Each ctrl In Me.Controls
If TypeName(ctrl) = "CheckBox" Then
If ctrl.Value = True Then
Else: Next ctrl
End If
Next ctrl
End Sub
Any help would be greatly appreciated.
Kind regards