sharky12345
Well-known Member
- Joined
- Aug 5, 2010
- Messages
- 3,404
- Office Version
- 2016
- Platform
- Windows
I'm using this to loop through column A and identify any cell which is less than 30 days ago, (the cells contain dates);
It's working, sort of, but doesn't do every cell, I have to run it several times to get it to do every cell - for info there are about 10000 rows of data but not sure if that would make a difference?
VBA Code:
MaxDate = Date - 30
LastRow = Sheet5.Range("A65000").End(xlUp).row
For Each Cell In Sheet5.Range("A2:A" & LastRow)
If Cell.Value >= MaxDate Then
Cell.EntireRow.Delete
End If
Next
It's working, sort of, but doesn't do every cell, I have to run it several times to get it to do every cell - for info there are about 10000 rows of data but not sure if that would make a difference?