I have quite a long program which is running, but I am trying to add one seemingly trivial section. I am not getting the right results, and I think it is something to do with the way in which I am setting up my if...then statement. I am novel to VBA, so I'm probably missing something simple. I'll post the code here.
For lRow = 2 To wsApt.Cells(Rows.Count, 1).End(xlUp).Row Step 1
sMoveIn = wsData.Cells(lRow, 13).Value
On Error Resume Next
If sMoveIn <> "" Then
wsApt.Cells(lRow, 5).Value = sRBeginDate
wsApt.Cells(lRow, 7).Value = sREndDate
Else
If sMoveIn > sRBeginDate Then
wsApt.Cells(lRow, 5).Value = sMoveIn
End If
End If
Next lRow
sMoveIn and sRBeginDate are dates, but they are dim'ed as strings. Is that a problem? Is there a way to declare a variable as a date?
Bookmarks