» Delete all cells with today's date using VBA
CATEGORY - Date & Time in VBA
VERSION - All Microsoft Excel Versions
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
Book Store:
Recommended Books:
- Yes, You Can Time the Market!
- Financial Statement Analysis: A Practitioner's Guide, 3rd Edition
- Microsoft Excel 2002 Visual Basic for Applications Step by Step
- Managing by the Numbers: A Commonsense Guide to Understanding and Using Your Company's Financials: An Essential Resource for Growing Businesses
- Rich Dad, Poor Dad: What the Rich Teach Their Kids About Money--That the Poor and Middle Class Do Not!
- Microsoft Excel 2002 Formulas (With CD-ROM)
No comments have been submitted.

