Letter Log Reminder with condition in other cells.

Rayreloj10

New Member
Joined
Jun 26, 2023
Messages
15
Office Version
  1. 2019
Platform
  1. Windows
Hello everyone,

I will try to explain again.

I'm trying to make a reminder for my letter log and I have more than 1 condition before it includes the letter number in the Msg Box. I have multiple sheet so I need to make the Msgbox appears everytime I click the sheets. I

here's my code I create. The code already works, however its displaying all the letter number in the cell. Msgbox should only display the letter number if it shows the value in the other cell as "OPEN".

really appriciate your help. Thank you in advance.


As you can see below, the condition is if the the DUEDATE is not empty and it is greater than or equal to the current Date -2. now I need to add one more condition. so then: if the DUEDATE is not empty and it is greater or equal to the current date -2 AND if the Status is "Open".


ABCD
E​
Letter NumberTitleIssued DateDue DateStatus
00001Letter126/Jun/2311/July/23Open
00002Letter225/Jun/2310/july/23Closed

VBA Code:
Option Explicit

Private Sub Worksheet_Activate()

Dim DateDueCol As Range
Dim DateDue As Range
Dim NotificationMsg As String
Dim LetterStatus As Range
Dim Status As Range


Set DateDueCol = ActiveWorkbook.Sheets("2023").Range("L10:L373")
'Set LetterStatus = ThisWorkbook.Sheets("2023").Range("N10:N373")


For Each DateDue In DateDueCol

If DateDue <> "" And Date >= DateDue - 2 Then
NotificationMsg = NotificationMsg & " " & DateDue.Offset(0, -11)
'ActiveWorkbook.Sheets("Register").Range("A10")

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
' ActiveWorkbook.Sheets("Register").Activate



End If
End Sub
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Just add another logical test to your existing tests. Perhaps
VBA Code:
If DateDue <> "" And Date >= DateDue - 2 And DateDue.Offset(0, 1) = "Open" Then
 
Upvote 0
Solution
Hi! again another issue comes up. for some reason the Msgbox is not updating with the new data entry. as shown above, in the current example. the message box will show the letter number "00001" and "00002". however, when you enter new letter number with the same condition, it will not show the new data entry.
 
Upvote 0
Then I guess you should be using the sheet change event instead of sheet activate?
 
Upvote 0
Thank you for your reply, I cannot use the sheet_change because the Msgbox will trigger everytime I change anything in the worksheet. I multiple log in the workbook, that is why I need the Msgbox to appear everytime I'm opening every worksheet.
 
Upvote 0
I'm not exactly sure what was the problem but my code is working perfectly now without changing anycode.
 
Upvote 0
Glad I could help, and thanks for the recognition.
 
Upvote 0

Forum statistics

Threads
1,223,881
Messages
6,175,161
Members
452,615
Latest member
bogeys2birdies

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