+ Reply to Thread
Results 1 to 4 of 4

Delete rows if cell in column contains

  1. #1
    Registered User
    Join Date
    07-01-2020
    Location
    Yerevan
    MS-Off Ver
    2010
    Posts
    44

    Delete rows if cell in column contains

    I have a vba code which deletes rows if cell in Column G is equal to "dog", "cat", "pig".

    How can I amend this code such that it deleted if CONTAINS rather than EQUAL?

    thank you

    Please Login or Register  to view this content.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,428

    Re: Delete rows if cell in column contains

    Try "*dog*" etc.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    07-01-2020
    Location
    Yerevan
    MS-Off Ver
    2010
    Posts
    44

    Re: Delete rows if cell in column contains

    it seems that this does not work, do you have any other ideas?

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,428

    Re: Delete rows if cell in column contains

    You could try "like" instead of "=".

+ 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. Replies: 1
    Last Post: 01-07-2019, 10:54 AM
  2. Delete all rows except when the rows in which the cell in column contains -138
    By bjcowen9000 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-15-2017, 01:32 AM
  3. [SOLVED] Delete rows if cell in column E is 0
    By billj in forum Excel Programming / VBA / Macros
    Replies: 19
    Last Post: 04-19-2017, 11:57 AM
  4. [SOLVED] Delete Rows Below if Any Cell in column is not blank:
    By Chad Bateman in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-07-2015, 12:51 PM
  5. [SOLVED] Delete rows if any cell in Sheet 1 rows matches any cell in Sheet2 column
    By newbie88 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-22-2012, 10:26 AM
  6. Delete Rows if cell value in a column are blank
    By excelrequest in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-11-2010, 01:30 PM
  7. Delete ALL rows that have cell in Column (J) that looks blank
    By Sanne in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-11-2010, 11:10 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