![]() |
|
|
|
#1
|
|||
|
|||
|
HI,
If the word "fitness" is in column "B" and there are no "Blanks" in column "B". This code may work. Not sure if the size of your data will effect it. Also as mentioned supply a copy of your work. Code:
Sub Test_Filter()
Dim i As Long
Dim VisRng As Range
Dim Myval As Long
Dim lrow As Long
'' set filter ''
lrow = Sheets("Sheet1").Range("B65536").End(xlUp).Row '' rename to your sheet
Sheets("Before").Range("A1:f1").Select
Selection.AutoFilter
With Selection
.AutoFilter Field:=2, Criteria1:="fitness" '' this set the filtered data for the value
End With
With Worksheets("Before").AutoFilter.Range
Set VisRng = .Resize(.Rows.Count - 1, 1).Offset(1, 0) _
.Cells.SpecialCells(xlCellTypeVisible)
'' make sure you have more than 1 row ''
Myval = .Range("B2:B" & lrow).SpecialCells(xlCellTypeVisible).Count
If Myval >= "2" Then
Range(Cells(VisRng.Offset(, 0).Row, 1), Cells(Range("B65536").End(xlUp).Row, 8)).EntireRow.Delete
End If
End With
Selection.AutoFilter
End Sub
|
|
| Tags |
| filter, filtering |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Need help with conditional formatting & returning "Pass" / "Fail Results" in a Column N | mikey386 | Excel | 2 | 12-11-2014 01:14 PM |
Linking between 2 relevant timelines
|
EC37 | Project | 11 | 06-06-2014 06:43 AM |
| 2013 search results take a long time - they fill in as results in reverse date order | themookman | Outlook | 0 | 10-11-2013 12:01 PM |
Scores returning ranked results
|
TerryStevenson | Excel | 1 | 09-16-2013 12:20 PM |
| How to relevant task to a folder | yoni | Outlook | 1 | 01-02-2012 12:29 AM |