Hi Guys,
I am having trouble writing a VBA code that would delete all rows if a cell contains a date of the prior month of the current month (i.e. for Jan. I would like to delete all rows that reference a date of 12/31/17 or prior). So far I have this, but I am currently stuck. Any tips would be appreciated. Thanks.
Sheets("3. Docs Charged").Select
With Sheets("3. Docs Charged")
lastrow = Cells(Rows.Count, 14).End(xlUp).Row
For i = lastrow To 2 Step -1
If Cells(i, 14).Value2 < Date Then Rows(i).EntireRow.Delete
Next i
End With
I am having trouble writing a VBA code that would delete all rows if a cell contains a date of the prior month of the current month (i.e. for Jan. I would like to delete all rows that reference a date of 12/31/17 or prior). So far I have this, but I am currently stuck. Any tips would be appreciated. Thanks.
Sheets("3. Docs Charged").Select
With Sheets("3. Docs Charged")
lastrow = Cells(Rows.Count, 14).End(xlUp).Row
For i = lastrow To 2 Step -1
If Cells(i, 14).Value2 < Date Then Rows(i).EntireRow.Delete
Next i
End With