+ Reply to Thread
Results 1 to 3 of 3

Delete certain rows with an input box

  1. #1
    Valued Forum Contributor
    Join Date
    04-11-2006
    MS-Off Ver
    2007
    Posts
    438

    Delete certain rows with an input box

    Hello all,

    I would like a macro that does this...

    Note for below that the "state" column will never be in a fixed column position, so this macro must search for "state" by name and not column position.



    1. Find the column named "state"
    2. Bring up a message box saying "Please enter the state/states you would like to use, separate each state with a comma"
    3. The user would then enter in each state/states they want to use and press "OK"
    4. The macro then deletes ALL ENTIRE ROWS NOT matching the state/states IN THAT COLUMN that were entered in the message box by the user (except the header row of course).

    To clarify number 4 further, the macro should ONLY look in the "state" column when deciding whether to delete the WHOLE ROW or not.

    5. The case should be non case-sensitive, for the "active worksheet", and if possible, should work whether the user enters in more states with either

    a) comma state

    or

    b) comma space state

    6. Also, I'm only using "states" for example reasons only but actual text length can more more characters long. The criteria entered in the message box should not be limited to two characters.


    thanks much!
    Last edited by duugg; 07-23-2009 at 11:24 AM. Reason: searchability

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Delete all rows not matching several criteria via input box...

    Try the attachment, you can see the code by hitting Alt F11.
    Attached Files Attached Files
    Martin

  3. #3
    Valued Forum Contributor
    Join Date
    04-11-2006
    MS-Off Ver
    2007
    Posts
    438

    Re: Delete all rows not matching several criteria via input box...

    mrice,

    worked awesome!

    thanks much!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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