+ Reply to Thread
Results 1 to 4 of 4

VBA filter deletes what I want to keep

  1. #1
    Registered User
    Join Date
    02-21-2018
    Location
    North Carolina
    MS-Off Ver
    MSOffice365 2302 Enterprise
    Posts
    46

    VBA filter deletes what I want to keep

    I am trying to have my autofilter keep everthing that is either Greensboro or Randleman and delete everything that is not.

    What am I missing?

    .AutoFilter Field:=5, Criteria1:= _
    "=*RANDLEMAN*", Operator:=xlOr, Criteria2:="=*GREENSBORO*"
    If .Columns(5).SpecialCells(xlCellTypeVisible).Count > 1 Then
    .Offset(1).Resize(n - 1).EntireRow.Delete
    End If
    .AutoFilter
    Last edited by dgrissom; 11-26-2019 at 10:08 AM.

  2. #2
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,908

    Re: VBA filter deletes what I want to keep

    You want the opposite of what you put:

    Please Login or Register  to view this content.
    Rory

  3. #3
    Registered User
    Join Date
    02-21-2018
    Location
    North Carolina
    MS-Off Ver
    MSOffice365 2302 Enterprise
    Posts
    46

    Re: VBA filter deletes what I want to keep

    Thank you @rorya. It was right before my eyes.

    Have a terrific Tuesday!!

  4. #4
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,908

    Re: VBA filter deletes what I want to keep

    Glad to help.

+ 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. Filter deletes rows that should not be filtered
    By DaveG93 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-14-2016, 03:35 AM
  2. macro deletes row
    By max_max in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 01-24-2016, 07:07 PM
  3. Code that Deletes Itself
    By Caligula in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-20-2007, 11:03 PM
  4. Adds abd Deletes
    By Peter Gedney in forum Excel General
    Replies: 1
    Last Post: 08-09-2006, 12:15 AM
  5. Deletes certain columns
    By T De Villiers in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-03-2006, 07:15 AM
  6. [SOLVED] Copy to in Adv filter deletes data in lower rows
    By Hari in forum Excel General
    Replies: 0
    Last Post: 05-30-2006, 05:25 AM
  7. [SOLVED] Repetative Row Deletes
    By scratching my head in forum Excel General
    Replies: 1
    Last Post: 05-30-2005, 05:05 PM

Tags for this Thread

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