|  

» Delete all cells with today's date using VBA

Question: How can I delete all rows with a date earlier than today using VBA?

Answer: Insert the following code in the appropriate modules.

Place the code below into the standard module


Sub Tryclear()
Dim intCounter As Integer, intLastRow As Integer
intLastRow = Cells(Rows.Count, 6).End(xlUp).Row
For intCounter = intLastRow To 1 Step -1
If Not IsEmpty(Cells(intCounter, 6)) And _
CDbl(Cells(intCounter, 6).Value) < CDbl(Date) Then
Rows(intCounter).Delete
End If
Next intCounter
End Sub



Rate This Tip
12 34 5
Rating: 2.17     Views: 32059
No comments have been submitted.
Click here to post comment
For Registered Users
Name
Comment Title
Comments