LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default AutoFilter code to delete rows

I want to use Ron de Bruin's
http://www.rondebruin.nl/delete.htm
AutoFilter code to delete a lot of rows.
The criteria for rows to be deleted is:
=OR(NOT(ISNUMBER(B9));AND(ISNUMBER(B9);ISTEXT(C9)) ;LEFT(D9;4)="Side")
from row 9 to row 30.000.

Any help on how to put this formula into Ron's below code:

Regards
Hans Knudsen


Sub Delete_with_Autofilter()
Dim DeleteValue As String
Dim rng As Range
Dim calcmode As Long

With Application
calcmode = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False
End With

'Fill in the value that you want to delete
'Tip: use DeleteValue = "<ron" to delete rows without ron
DeleteValue = "ron"

'Sheet with the data, you can also use Sheets("MySheet")
With ActiveSheet

'Firstly, remove the AutoFilter
.AutoFilterMode = False

'Apply the filter
.Range("A1:A" & .Rows.Count).AutoFilter Field:=1,
Criteria1:=DeleteValue

With .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

'Remove the AutoFilter
.AutoFilterMode = False
End With

With Application
.ScreenUpdating = True
.Calculation = calcmode
End With

End Sub

 
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
Delete Rows with Autofilter and partial cell. [email protected] Excel Programming 1 June 29th 07 08:20 PM
VBA code to delete rows Secret Squirrel Excel Discussion (Misc queries) 3 January 21st 07 03:01 PM
How to use autofilter to delete duplicate rows (2nd criteria) ? Mslady[_11_] Excel Programming 2 October 29th 05 06:36 PM
code to delete rows ianalexh Excel Discussion (Misc queries) 5 May 5th 05 10:46 AM
delete rows autofilter masterphilch Excel Programming 3 January 5th 05 08:07 PM


All times are GMT +1. The time now is 02:40 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"