+ Reply to Thread
Results 1 to 2 of 2

Autofilter with delete entire row

  1. #1
    Registered User
    Join Date
    09-01-2016
    Location
    Scotland
    MS-Off Ver
    2013
    Posts
    8

    Autofilter with delete entire row

    Hello,

    I've been muddling through solving this problem but have got stuck now, goal is to use autofilter to identify rows that do not contain value 1 or value 2 in column c and then delete those rows thus leaving me with only rows containing value 1 or 2

    Dim rngTemp As Range


    Set rngTemp = Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious)
    If Not rngTemp Is Nothing Then
    Range(Cells(1, 1), rngTemp).Select
    .AutoFilter Field:=3, Criteria1:=Array("*UK*", "*02*"), Operator:=xlFilterValues
    End If


    After row Range(Cells(1, 1), rngTemp).Select . My selected range is good and I can see it in the worksheet, but I cant figure out my next step as the following line will not compile

    Any help much appreciated

    Dex

  2. #2
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: Autofilter with delete entire row

    The better tool is AdvancedFilter. If you need help to see how the criterion are setup, see:
    https://support.office.com/en-us/art...8-3f16abdff32b
    http://www.contextures.com/xladvfilter01.html

    I do have a concern about your *01*. If that is for text values like A01X, that is ok. If it is for a number value of 1 number formatted to 01, then that would not be ok. In that case, you will need to convert the column of values to the TEXT value and not VALUE property.
    Last edited by Kenneth Hobson; 11-25-2016 at 10:59 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Macro Needed to Delete Entire Row if the Entire Row (Or Col A,B,C,D in row ) are blank
    By swade730 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-04-2016, 06:32 AM
  2. VBA code to delete the FILTERED range and moving the cell up (dont Delete entire row)
    By mchilapur in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-14-2015, 07:48 AM
  3. Replies: 4
    Last Post: 10-12-2014, 08:54 AM
  4. [SOLVED] Increase autofilter field by 1 across the entire project
    By bibu in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-10-2014, 01:29 PM
  5. [SOLVED] Delete cell only with certain critria. Don't want to delete entire row, the celsl only
    By RobertOHare in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-16-2013, 04:18 AM
  6. [SOLVED] Autofilter will not always select entire sheet
    By Mogadeet in forum Excel General
    Replies: 5
    Last Post: 09-04-2009, 12:30 PM
  7. Delete entire row when cell says delete
    By Macdave_19 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 09-27-2007, 11:46 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1