+ Reply to Thread
Results 1 to 7 of 7

Deleting rows NOT containing defined values

  1. #1
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326

    Deleting rows NOT containing defined values

    Hi,
    following macro published by ron de bruin deletes all rows in a table where a cell contains a specific value in a given column.
    The specific values are contained in an array like
    Please Login or Register  to view this content.
    But in fact, the number of elements of the array could increase in time.
    So I would like to adapt the macro so that it deletes all rows NOT containing given values ( they wil not vary in time)

    As I am completely novice in VBA, I would appreciate your help very much

    Please Login or Register  to view this content.


    Thanks in advance

    André

  2. #2
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    Change column A to suit
    Change Value1, Value2 etc to suit

    Please Login or Register  to view this content.
    Please Read Forum Rules Before Posting
    Wrap VBA code by selecting the code and clicking the # icon or Read This
    How To Cross Post politely

    Top Excel links for beginners to Experts

    If you are pleased with a member's answer then use the Scales icon to rate it
    If my reply has assisted or failed to assist you I welcome your Feedback.

  3. #3
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326
    Thx Mudraker,
    my first attempt erased everything, not realizing the values were case sensitive.
    If I want to keep the first row sould I use ?
    Please Login or Register  to view this content.

  4. #4
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    Yeap change the 1 to 2

    To eliminate the case sensitve

    use

    Please Login or Register  to view this content.
    and enter the case values in lower case

    Please Login or Register  to view this content.

  5. #5
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326
    Hi mudraker,
    thanks for the input
    I think it will work perfectly and I'll try it Tuesday at work.
    You'll get feedback ASAP

    André

  6. #6
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326
    Hi Mudraker
    Macro worked great
    Many thx

  7. #7
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    thanks for the feedback

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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