Rayreloj10
New Member
- Joined
- Jun 26, 2023
- Messages
- 15
- Office Version
- 2019
- Platform
- Windows
Hi!
new issue came up, previous issue is resolved. However, the Msgbox only display the current data in the cell. if new data is entered in the worksheet, it will still show the previous msg. like for example as shown below. The msgbox will show that reminds your that the letter number 00001 is open. but when you add letter number 00003, msgbox will not show the new data entry 00003.
in addition, when you change the status of existing data into "Closed", such as letter number 00001, it will be deleted in the message box but when you change it back in "Open" status will be not appear again. I already modify the Range to make sure that it covers the new data entry.
Thank you for the assistance in advance.
new issue came up, previous issue is resolved. However, the Msgbox only display the current data in the cell. if new data is entered in the worksheet, it will still show the previous msg. like for example as shown below. The msgbox will show that reminds your that the letter number 00001 is open. but when you add letter number 00003, msgbox will not show the new data entry 00003.
in addition, when you change the status of existing data into "Closed", such as letter number 00001, it will be deleted in the message box but when you change it back in "Open" status will be not appear again. I already modify the Range to make sure that it covers the new data entry.
Thank you for the assistance in advance.
A | B | C | D | E |
Letter Number | Title | Issued Date | Due Date | Status |
00001 | Letter1 | 26/Jun/23 | 11/July/23 | Open |
00002 | Letter2 | 25/Jun/23 | 10/july/23 | Closed |
00003 | Letter3 | 07/july/23 | 10/july/23 | Open |
VBA Code:
Option Explicit
Private Sub Worksheet_Activate()
Dim DateDueCol As Range
Dim DateDue As Range
Dim NotificationMsg As String
Set DateDueCol = ActiveWorkbook.Sheets("2023").Range("L10:L373")
For Each DateDue In DateDueCol
If DateDue <> "" And Date >= DateDue - 2 and DateDue.Offset(0, 1) = "Open"Then
NotificationMsg = NotificationMsg & " " & DateDue.Offset(0, -11)
End If
Next DateDue
If NotificationMsg = "" Then
MsgBox "We don't have any pending letter response."
Else: MsgBox "Reminder: We have a pending letters." & vbCrLf & vbCrLf & vbCrLf & NotificationMsg
End If
End Sub