Josh381991
New Member
- Joined
- Nov 9, 2022
- Messages
- 6
- Office Version
- 2007
- Platform
- Windows
Good afternoon,
I am super new to VBA and hoping for some help.
I have a training log for all employees which lists modules and dates of expiry. I am attempting to get a pop up that automatically tells me what employees have outstanding training due. I used and amended a code from the internet which I have posted below. This works to a degree in that it pulls up what is expiring but it pulls up the dates rather than the employees name as shown below.
The employees names are in column A5 to A37 with the modules being in Row 4 to column AO. The dates are within A5 to AO37.
The H1 bit in the code allows me to set number of days I wish to search ie all dates occurring within the next X days.
Ideally I would like the pop up to come up saying training due for the following employees. Employee A Module C Employee D Module X etc.
I really hope that makes sense.
Sub Due_Date()
Dim DueDate_Col As Range
Dim Due As Range
Dim PopUp_Notification As String
Set DueDate_Col = Range("C5:AO37")
For Each Due In DueDate_Col
If Due <> "" And Date >= Due - Range("H1") Then
PopUp_Notification = PopUp_Notification & " " & Due.Offset(0, -2)
End If
Next Due
If PopUp_Notification = "" Then
MsgBox "No outstanding training"
Else: MsgBox "Training due for these individuals: " & PopUp_Notification
End If
End Sub
Thank you in advance.
I am super new to VBA and hoping for some help.
I have a training log for all employees which lists modules and dates of expiry. I am attempting to get a pop up that automatically tells me what employees have outstanding training due. I used and amended a code from the internet which I have posted below. This works to a degree in that it pulls up what is expiring but it pulls up the dates rather than the employees name as shown below.
The employees names are in column A5 to A37 with the modules being in Row 4 to column AO. The dates are within A5 to AO37.
The H1 bit in the code allows me to set number of days I wish to search ie all dates occurring within the next X days.
Ideally I would like the pop up to come up saying training due for the following employees. Employee A Module C Employee D Module X etc.
I really hope that makes sense.
Sub Due_Date()
Dim DueDate_Col As Range
Dim Due As Range
Dim PopUp_Notification As String
Set DueDate_Col = Range("C5:AO37")
For Each Due In DueDate_Col
If Due <> "" And Date >= Due - Range("H1") Then
PopUp_Notification = PopUp_Notification & " " & Due.Offset(0, -2)
End If
Next Due
If PopUp_Notification = "" Then
MsgBox "No outstanding training"
Else: MsgBox "Training due for these individuals: " & PopUp_Notification
End If
End Sub
Thank you in advance.