Thread: deleting rows
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
H.
 
Posts: n/a
Default deleting rows

Thx Ron,

I will try tomorrow or monday (as soon as I am working on this workbook
again). And of course I let you know if it worked!

H.



"Ron de Bruin" schreef in bericht
...
Try this macro for the range A1:A10000
A1 is a header

Sub Delete_with_Autofilter()
Dim rng As Range

With ActiveSheet
.Range("A1:A10000").AutoFilter Field:=1, Criteria1:="=" &
DateSerial(2006, 4, 1), _
Operator:=xlOr, Criteria2:="<=" & DateSerial(2005, 12, 31)
With ActiveSheet.AutoFilter.Range
On Error Resume Next
Set rng = .Offset(1, 0).Resize(.Rows.Count - 1, 1) _
.SpecialCells(xlCellTypeVisible)
On Error GoTo 0
If Not rng Is Nothing Then rng.EntireRow.Delete

End With
.AutoFilterMode = False
End With
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"H." wrote in message
...
yes...
and the last day is 31 of march

"Ron de Bruin" schreef in bericht
...
Is Jan 1 the first day of quarter 1?