View Single Post
 
Old 09-22-2015, 09:22 AM
NoSparks NoSparks is offline Windows 7 64bit Office 2010 64bit
Excel Hobbyist
 
Join Date: Nov 2013
Location: British Columbia, Canada
Posts: 842
NoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of light
Default

If I understand what you want, and I'm not sure I do....
Perhaps something like this ?

Code:
Sub pop_message_Click()  ' notification
    Dim rng As Range
    Dim cel As Range
    Dim lastrow As Long
    Dim Licensee As String
    Dim msg1 As String, msg2 As String, msg3 As String

Application.ScreenUpdating = False

With Sheets("Sheet1")        '<~~ change to suit
    lastrow = .Cells(Rows.Count, "B").End(xlUp).Row
    Set rng = .Range("B2:B" & lastrow)
    msg1 = "THE ROP LINCENCE FOR MR" & vbCrLf & vbCrLf
    msg3 = vbCrLf & "EXPIRE WITHIN NEXT 30 DAYS"
    
    For Each cel In rng
        If cel.Value >= Date And cel.Value <= Date + 30 And cel.Offset(0, 1).Value <> "informed" Then
            Licensee = cel.Offset(0, -1).Value
            msg2 = msg2 & "      " & UCase(Licensee) & vbCrLf
            cel.Interior.ColorIndex = 0
            cel.Offset(0, 1).Value = "informed"
        End If
    Next cel
End With

If Len(msg2) > 0 Then MsgBox msg1 & msg2 & msg3, vbCritical, "Warning"
   
Application.ScreenUpdating = True

End Sub
Reply With Quote