here is the loop I tried, but it hangs at next i with the error message: next i without for.
this condition should allow me to test only the day and the month to know if it is the anniversary because my range E is formatted at (dd.mmm.1900
as mentioned above, the goal is to test line by line by line. If the condition is verified, send the message and continue the procedure until the last line.
If the condition is not verified, skip the line and continue the procedure
Dim Recipient As String
Dim Message As String
Dim i As Integer
Dim rowname As String
Dim rownumber As String
Dim rowdateanniv As Double
'Dim rowtimerdv, rownumber, rowdaterdv, x As String
'rowtimerdv = Worksheets("PLANNING").Range("I4").Text
'rowprestardv = Worksheets("PLANNING").Range("H4").Text
rowname = Worksheets("CLIENTS").Range("D35:D5000").Value
rownumber = Worksheets("CLIENTS").Range("D35:D5000").Value
rowdateanniv = Worksheets("CLIENTS").Range("E35:E5000").Value
x = "237"
Recipient = x & rownumber
'If Now - Date > TimeSerial(9, 0, 0) Then
For i = 35 To 5000
If (Day(Worksheets("CLIENTS").Cells(i, 5).Value) = Day(Date) And Month(Worksheets("CLIENTS").Cells(i, 5).Value) = Month(Date)) Then
Message = "Dear " & rowname & ", we wish you a happy birthday and all the best for you."
'Next i
Else
Exit Sub
Next i
End If
End If
Bookmarks