VBA Delete Excel Rows Based on Certain Date

Let say I have a bunch of formatted data in my Excel sheet, and in Column A I have a dates. Then I wanna filter all the data base on certain date, for example 1 Jan 2009, and delete all others data before that date.

The algorithm is like this: I’ll create a loop from the first row until the last row with data and check if the date is before Jan 1st, 2009 or not, if it is, simply delete that row.

Sub DeleteFilteredRows()
    Dim i As Long

    For i = 1 To Cells.SpecialCells(xlCellTypeLastCell).Row
        Debug.Print Cells(i, "A").Value
        If CDate(Cells(i, "A")) < CDate("1/jan/2009") Then
            Cells(i, "A").EntireRow.Delete
        End If
    Next i

End Sub

Of course I’ll make an adjustment to the code above to meet my current condition.

FIN.

This entry was posted in Cells and Range, Workbook and Worksheet and tagged , , , , , , , . Bookmark the permalink.

1,066 Responses to VBA Delete Excel Rows Based on Certain Date

  1. Pingback: painting contractors brisbane

  2. Pingback: the lawyers in oklahoma city

  3. Pingback: click here

  4. Pingback: click here

  5. Pingback: cheap club flyers

  6. Pingback: gogo games

  7. Pingback: tv live

  8. Pingback: buy list

  9. Pingback: Video: Facebook trades below expectations | 5 Star Family Vacation Spots

  10. Pingback: retrofitting

  11. Pingback: servis char

  12. Pingback: symbol bar code scanner

  13. Pingback: here

  14. Pingback: instant loan

  15. Pingback: roswell tree service

  16. Pingback: online backup services

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>