remove row with some data not exact

  • Thread starter Thread starter Poohberry
  • Start date Start date
P

Poohberry

I have a spreadsheet that I want to delete the entire row if it contains
04-29-2010 but there is a time stamp that changes after that.

How do I delete all the rows containing 04-29-2010 with random data after?

Thanks in advance for your brilliance!
 
Assumes valid dates & times are in Column A with Range A1 being a heading;

Sub DoIt()
Dim lRow As Long

With Application
.ScreenUpdating = False
.EnableEvents = False
.Calculation = xlCalculationManual
End With
On Error Resume Next
For lRow = Cells(Rows.Count, "A").End(xlUp).Row To 2
If Int(Cells(lRow, "A")) _
= DateSerial(2010, 4, 29) Then _
Cells(lRow, "A").EntireRow.Delete
Next lRow
On Error GoTo 0
With Application
.ScreenUpdating = True
.EnableEvents = True
.Calculation = xlCalculationAutomatic
End With
End Sub
 
04-29-2010 10:53:03 AM
39 / 1417

that is an example it was a txt file now a .csv opened in excel 07 all on
column a
 
Step1: For time-being, you can change cell formatting such way that it does
not show time but only shows date in mm-dd-yyyy format.

Step2: Apply data filter

Step3: From filter drop-down, select/filter to show dates that you want to
delete.

Step4: Select all visible/filtered lines and say Delete, it will ask if you
want to delete entire row?, say yes.
 
I actualy need to remove the data filtering it will confuse people, I need it
to just be gone.
 
Back
Top