+ Reply to Thread
Results 1 to 8 of 8

Find rows to delete with a macro based on cell content

  1. #1
    Registered User
    Join Date
    08-27-2013
    Location
    Denver, CO
    MS-Off Ver
    Excel 2007
    Posts
    4

    Question Find rows to delete with a macro based on cell content

    I've written a macro to create 2 worksheets containing data from a 3rd worksheet. My macro works fine, but it's "stupid". I manually selected rows on new worksheet for deletion. I can't figure out a way to have the macro delete the rows based on the contents of the cell in column A. How can I have the macro automatically determine which rows to delete? I've attached a copy of the spreadsheet with dummy data so you can see what I'm trying to do. I can't use a formula to do this because it won't pick up the background color formatting. Also, each entry on the first sheet could have anywhere from 1-3 rows depending on the type of change being documented. The only constants are the contents of the cells in column A.

    Thanks.
    Attached Files Attached Files
    Last edited by mkraffert; 08-28-2013 at 02:33 PM.

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Find rows to delete with a macro based on cell content

    So are you asking that the entries having any yellow formatting are deleted?

  3. #3
    Registered User
    Join Date
    08-27-2013
    Location
    Denver, CO
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Find rows to delete with a macro based on cell content

    Quote Originally Posted by mehmetcik View Post
    So are you asking that the entries having any yellow formatting are deleted?
    No. I want to retain any rows that have yellow formatting and but do not contain the word "Existing" in the first column, and delete the reset, except for the top header row.

  4. #4
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Find rows to delete with a macro based on cell content

    Hi mkraffert

    Welcome to the Forum!

    I'd have to say, if
    My macro works fine
    then it's not
    "stupid"
    It may need to be cleaned up a bit and we can help you with that. Won't be me tonight...perhaps another...if not, I'll look at it tomorrow.
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  5. #5
    Registered User
    Join Date
    08-27-2013
    Location
    Denver, CO
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Find rows to delete with a macro based on cell content

    Thanks John. I didn't mean "stupid" in a derogatory sense. Maybe "primitive" would have been a better word. Or maybe it's me who's "stupid" since I can't figure out how to make it select rows based on part of the contents of a cell on the row.

  6. #6
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Find rows to delete with a macro based on cell content

    Hi mkraffert

    Here's new Code for Sub Dev()
    Please Login or Register  to view this content.
    Why don't you play with Sub Threshold()...run into troubles let me know.

  7. #7
    Registered User
    Join Date
    08-27-2013
    Location
    Denver, CO
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Find rows to delete with a macro based on cell content

    Great! Thank you. I'll definitely let you know if I run into problems. The complete workbook has several other similar funtions I'm going to implement as well.

  8. #8
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Find rows to delete with a macro based on cell content

    You're welcome...glad I could help. Thanks for the Rep.

+ 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. [SOLVED] Macro to delete rows if any cell contains specific content
    By adayoan in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 10-31-2012, 07:11 PM
  2. delete certain rows based on their partial cell content
    By WasWodge in forum Excel General
    Replies: 3
    Last Post: 01-30-2011, 02:37 PM
  3. Delete rows based on cell content
    By scaffdog845 in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 05-06-2010, 07:34 PM
  4. Need help to delete rows based on cell content
    By iturnrocks in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-17-2008, 12:10 PM
  5. Replies: 2
    Last Post: 10-03-2005, 10:05 AM

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