Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 07-12-2015, 05:33 PM
charlesdh charlesdh is offline Filter not returning all relevant results Windows 7 32bit Filter not returning all relevant results Office 2010 32bit
Expert
 
Join Date: Apr 2014
Location: Mississippi
Posts: 382
charlesdh is on a distinguished road
Default

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
Reply With Quote
Reply

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
Filter not returning all relevant results 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
Filter not returning all relevant results 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

Other Forums: Access Forums

All times are GMT -7. The time now is 11:01 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft