I found this one which had a same problem. I notice that the problem was in formated sheet. I take out the formated and now it work except that when the expire date is far away and there is no need to do anythig it popup the "test text" only with out names and days. If the expires dates is near the range "40" it give the right message with the "test text" and names and days.
Sub popup()
Dim lstRow As Long
Dim i As Long
Dim msg As String
Dim ws As Worksheet
Set ws = ThisWorkbook.Worksheets("sheet1") ' rename as required
With ws
msg = "test text " & vbCrLf & vbCrLf
lstRow = .Cells(.Rows.Count, "S").End(xlUp).Row
For i = 2 To lstRow
If .Range("S" & i) - (Date) <= 40 Then
msg = msg & .Range("B" & i).value & " in " & .Range("S" & i).value - Date & " days" & vbCrLf
End If
Next i
End With
MsgBox msg
'Call settimer
End Sub
Aucun commentaire:
Enregistrer un commentaire