I manage a contract log that list out all of my company's contracts with the effective and expiring date.
I've written VBA code that alerts me whenever any one of the contracts is about to expire; a message box will show up that tells me the "carrier's contract# is about to expire". (Please see the code below).
However, because there are different Amendments for each contract, the same contract number may be listed out multiple times in the spreadsheet. If one contract is about to expire, the code notifies me multiple times.
How can I modify my code so it only alerts me once for the same contract number?
Column A is the carrier name, column B is the contract #, Column C is the Amendment# and Column G is the expiration date for each contract.
Let me know if I didn't make myself clear enough or more information is needed.
Private Sub Workbook_Open()
Dim rngC As Range
With Worksheets("NON-TPEB SC LOGS(OPEN)")
For Each rngC In .Range(.Range("G5"), .Cells(.Rows.Count, "G").End(xlUp))
If rngC.Value > Now And (rngC.Value - Now) < 7 Then
MsgBox .Cells(rngC.Row, 1).Value & "'s " & _
.Cells(rngC.Row, 2).Value & " is expiring!!"
End If
Next rngC
End With
End Sub