Letter Log Reminder MsgBox not updating

Rayreloj10

New Member
Joined
Jun 26, 2023
Messages
15
Office Version
  1. 2019
Platform
  1. 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.

ABCDE
Letter NumberTitleIssued DateDue DateStatus
00001Letter126/Jun/2311/July/23Open
00002Letter225/Jun/2310/july/23Closed
00003Letter307/july/2310/july/23Open

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
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
I do not see either of those problems when I run your code. Keep in mind that you are using the Worksheet_Activate event to run your code. It only runs when you first activate the worksheet, not when you make changes like adding a line or changing a status value from Open to Closed. To see the changes you have to leave the worksheet and come back so that the Worksheet_Activate event runs again.

Book1
ABCDEFGHIJKLM
1Letter NumberTitleIssued DateDue DateStatus
2
3
4
5
6
7
8
9
101Letter126-Jun-2311-Jul-23Open
112Letter225-Jun-2310-Jul-23Open
123Letter37-Jul-2310-Jul-23Closed
134Letter37-Jul-2310-Jul-23Open
2023
 
Upvote 0
Solution
I do not see either of those problems when I run your code. Keep in mind that you are using the Worksheet_Activate event to run your code. It only runs when you first activate the worksheet, not when you make changes like adding a line or changing a status value from Open to Closed. To see the changes you have to leave the worksheet and come back so that the Worksheet_Activate event runs again.

Book1
ABCDEFGHIJKLM
1Letter NumberTitleIssued DateDue DateStatus
2
3
4
5
6
7
8
9
101Letter126-Jun-2311-Jul-23Open
112Letter225-Jun-2310-Jul-23Open
123Letter37-Jul-2310-Jul-23Closed
134Letter37-Jul-2310-Jul-23Open
2023
That's why I'm confused yesterday, I run different test to check what is the problem. I even closed the excel but it shows the same result. It might be some kind of bug in excel, right now it working perfectly, eventhough I did not change anything in the code.
 
Upvote 0

Forum statistics

Threads
1,215,086
Messages
6,123,035
Members
449,092
Latest member
ikke

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top