+ Reply to Thread
Results 1 to 6 of 6

Delete entire row based on text color? Format Macro?

  1. #1
    Forum Contributor
    Join Date
    01-28-2013
    Location
    Spencerport, NY
    MS-Off Ver
    Excel 2016
    Posts
    270

    Delete entire row based on text color? Format Macro?

    Hello All
    I was wondering if it is possible in Excel to delete an entire row if a cell in that row is a particular color?
    I am looking to delete the rows that have the color red (9.11.16.18 etc) in the attached spreadsheet
    As always, thanks so much
    Ron
    Attached Files Attached Files

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

    Re: Delete entire row based on text color? Format Macro?

    It is possible using a macro but very slow.
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  3. #3
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,474

    Re: Delete entire row based on text color? Format Macro?

    You could use the filter, and filter for colors, then delete the rows that way.

    Please Login or Register  to view this content.

  4. #4
    Forum Contributor
    Join Date
    02-09-2009
    Location
    London
    MS-Off Ver
    Office 365
    Posts
    380

    Re: Delete entire row based on text color? Format Macro?

    It's possible Ron but you need to use vba & the first little problem I see is that your first segments are varying in height, it'd be best to keep them the same amount of rows high if possible. It'd still be possible to do it I think but there would be more work in the code. You'd have to test the colour of each few rows as opposed to just one.

    I've written some basic code in the attached that will do it on a red, but this is prone to errors as they could have a different shade of red. Also another flaw in what I've done loops over a million rows, it'd be better to determine how you work and what are the likely maximum amount of rows you'd ever encounter.
    Attached Files Attached Files

  5. #5
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,474

    Re: Delete entire row based on text color? Format Macro?

    Quote Originally Posted by Dal123 View Post
    It's possible Ron ..........
    Instead of looping for every row, find the last row number and only loop that many times.
    Always best to loop backwards when you are deleting rows or you will miss rows that meet the criteria.
    Please Login or Register  to view this content.
    This ensure you are working from the bottom going up

  6. #6
    Forum Contributor
    Join Date
    01-28-2013
    Location
    Spencerport, NY
    MS-Off Ver
    Excel 2016
    Posts
    270

    Re: Delete entire row based on text color? Format Macro?

    WOW ! Thanks so much everyone.I am not sure what was meant by filtering by color and then deleting..I am not familiar with that functionality.I assumed a macro is what I needed (which is what I was afraid of).The example is a very small sample of what I need to edit as the entire worksheet is 64 K rows ..Macros are out of my league so I guess it will be a good time to learn and install install /edit these examples. Many many thanks to everyone
    Ron

+ 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. Need macro to delete entire row based on column name.
    By Revathi kannan in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-24-2016, 01:35 PM
  2. [SOLVED] Macro to Delete Entire Row Based on Formula in Given Column
    By datutt in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-19-2015, 10:12 PM
  3. Macro or rule to color fill an entire row based on successive dates within data
    By ferretdance03 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-19-2013, 02:20 PM
  4. Macro to format row color in a range based on text value in column
    By toaksie in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-25-2012, 12:54 PM
  5. Macro to delete entire row based on cell contents
    By ATX in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 10-06-2011, 03:52 AM
  6. macro to delete entire row based on TWO cell values
    By uncleslinky in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-05-2011, 02:42 PM
  7. Macro to delete entire rows based values in columns
    By shamade2107 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-13-2009, 11:17 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