Macro want delete the date row?
Hi Shetty,
Try this
Sub Date_Single()
Dim i As Long
i = 1
Do While Not IsEmpty(Cells(i, "A").Offset(1, 0).Value)
With Cells(i, "A")
If .Offset(1, 0).Text = "21-Feb2003" Then
.Offset(1, 0).EntireRow.Delete shift:=xlUp
End If
End With
i = i + 1
Loop
Range("A1").Select
End Sub
--
HTH
Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
"Shetty" wrote in message
om...
Hi all,
I need to delete the rows based on the date in Col A.
I have written the following macro but it want work.
Even it does not give any errors.
My Code :
============
Sub Date_Single()
Range("A1").Select
Do While Not IsEmpty(ActiveCell.Offset(1, 0).Value)
If ActiveCell.Offset(1, 0).Value = "10/21/2003"
ActiveCell.Offset(1, 0).EntireRow.Delete shift:=xlUp
End If
ActiveCell.Offset(1, 0).Select
Loop
Range("A1").Select
End Sub
=============
All the cells in Col A is formated as date (27-Feb-04 format) and
I ensure this with the data velidation.
Can somebody please tell me what went wrong?
Regards,
Shetty.
|