+ Reply to Thread
Results 1 to 4 of 4

creating a macro to delete a row in a spreadsheet if the cell contains specified text

  1. #1
    Registered User
    Join Date
    09-29-2009
    Location
    Minnesota
    MS-Off Ver
    Excel 2003
    Posts
    5

    creating a macro to delete a row in a spreadsheet if the cell contains specified text

    Hello all -

    I need some help making a macro for a 2003 version excel file. I have a column (AX) with some entries like the following

    2051CG2A22A2AS1B4M5P2
    2051TG4A2B21AS1B4M5D4
    2088G2S22A1B4
    3051S2CD2A2D11A1AM5


    The macro needs to find the combination's like 2051 with S1, or 3051S with D11 within the cell. If it finds a combination like that, it should delete the entire row. If I have a macro like that, the only remaining entry from above would be 2088G2S22A1B4. Could somebody please help me out with this....it would be greatly appreciated!!!

    Dan
    Last edited by dtm8119; 09-29-2009 at 11:34 AM.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: making my first Macro!

    Welcome to the forum.

    Please take a few minutes to read the forum rules, and then amend your thread title appropriately.

    thanks.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    09-29-2009
    Location
    Texas
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: creating a macro to delete a row in a spreadsheet if the cell contains specified

    Here's a quick and dirty run through. Highlight the cells containing the values you're testing against and then run this:
    Please Login or Register  to view this content.
    Note that it clears the entire row. When looping through a Selection it gets kinda tricky when you delete a range contained within. Excel doesn't really take into account the Selection changes when you delete/add within it. You can code around that, of course, but I'm keeping it basic.

  4. #4
    Registered User
    Join Date
    09-29-2009
    Location
    Minnesota
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: creating a macro to delete a row in a spreadsheet if the cell contains specified

    Thank you....I'll give that a try!

+ 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