#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?







Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
resetting last cell jagdish.eashwar Excel Discussion (Misc queries) 11 March 31st 06 02:06 AM
stop users from deleting rows wAyne Excel Discussion (Misc queries) 2 February 4th 06 05:57 PM
Deleting rows in a macro in Excel THEFALLGUY Excel Discussion (Misc queries) 4 December 23rd 05 01:59 PM
Question about deleting rows from sorted linked worksheets DewChugr Excel Worksheet Functions 0 September 20th 05 09:25 PM
Deleting rows containing common data gcotterl Excel Discussion (Misc queries) 1 January 4th 05 12:58 AM


All times are GMT +1. The time now is 10:50 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"