logstarter
New Member
- Joined
- Apr 14, 2017
- Messages
- 39
Hi,
I have written the following VBA code but it seems that it doesn't work because the code keeps creating the new row even the date is today. I would like to seek advice if anything wrong in my code.
Thanks so much!
I have written the following VBA code but it seems that it doesn't work because the code keeps creating the new row even the date is today. I would like to seek advice if anything wrong in my code.
Thanks so much!
Code:
Sub createDate()
Dim lRow As Long
z = Format(Now, "dd/mm/yyyy")
lRow = Worksheets("Log").Cells(Rows.count, 1).End(xlUp).Row
lRowValue = Worksheets("Booking Log").Cells(lRow, 1).Value
If (lRowValue <> z) Then
Worksheets("Log").Cells(lRow + 1, 1).Value = z
Worksheets("Log").Cells(lRow + 1, 2).Value = 0
End If
End Sub