Hello All,

I am trying to populate cells with a date that is located next to a cell with the word "Visit."

This is my code:

lRow = Cells(Rows.Count, "A").End(xlUp).Row


Do While True
If Cells(lRow, 6) = "Visit" Then
    sLastValue = Cells(lRow, 5)
Else
    Cells(lRow, 5) = sLastValue
End If

lRow = lRow - 1

Loop
I get a run-time error 1004 (Application defined or object defined error) and when I hit "debug" the part in red font is the problem area.
The weird thing though is when I look at my spreadsheet, the code works. It does what I want. But this code is a small part of a larger macro, so the error causes my macro to stop running. Any and all help is much appreciated!