Hi
See how this goes. I've put a result in column O to determine the pay type for the time being to test things.
Sub aaa()
periodlen = 20
perend = Range("A10").Value
For Each ce In Range("K10:K" & Cells(Rows.Count, "K").End(xlUp).Row)
If Len(ce) > 0 Then
If Cells(ce.Row, 1) > DateValue(perend) Then
perend = Cells(ce.Row, 1) + periodlen
cntr = 1
ElseIf Cells(ce.Row, 1) <= perend Then
cntr = cntr + 1
End If
If cntr > 3 Then
Cells(ce.Row, "O").Value = "Paid"
Else
Cells(ce.Row, "O").Value = "Waiting"
End If
End If
Next ce
End Sub
rylo
Bookmarks