View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default Delete Rows Where Value in Column V is Less than 2.5?

Hi Steve

We used this in that thread

DeleteValue = "*Total*"


Now we use

DeleteValue = "<2.5"

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

DeleteValue = "<2.5"
With ActiveSheet
.Range("V1:V2000").AutoFilter Field:=1, Criteria1:=DeleteValue
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


"SteveC" wrote in message ...
Hi, this question is related to another Auto Filter macro question I had last
week (see below for the URL if interested).

I think the title of this question is clear enough. I have about 2000 rows
of data. I would like to delete all the rows where the Value in any cell in
Column V is less than 2.5.

How do I do this? Thanks very much!

Regards
Steve C





http://www.microsoft.com/office/comm...xp=&sloc=en-us