+ Reply to Thread
Results 1 to 11 of 11

Delete all rows with yellow or blue

  1. #1
    Registered User
    Join Date
    04-02-2013
    Location
    california, usa
    MS-Off Ver
    Excel 2010
    Posts
    33

    Delete all rows with yellow or blue

    I have rows and rows of information, and some rows are highlight yellow and some highlight blue. i want to delete all rows, except for the ones that are blue or yellow.

  2. #2
    Forum Expert
    Join Date
    11-26-2013
    Location
    Colac, Victoria, Australia
    MS-Off Ver
    Excel 2016
    Posts
    1,309

    Re: Delete all rows with yellow or blue

    Hi ekr,

    Do you want to do it manually?

    You can use the FILTER feature of Excel.

    Just set filters for the data range.

    Then click on any column with a filter and use the FILTER BY COLOR option, and select No Fill.

    Now select all visible rows. (F5; Special...; Visible cells only)

    Press Delete.

    NB: You could lose your headings, so make sure they are shaded as well.

    You can do it by Macro as well, but a lot of people are wary of macros.

    I hope this helps, please let me know!

    Regards,

    David

    If this has been of assistance, please advise. A little thanks goes a long way.
    - Please click on the *Add Reputation button at the bottom of helpful responses.

    Please mark your thread as SOLVED:
    - Click Thread Tools above your first post, select "Mark your thread as Solved".

    When you reply please make it clear WHO you are responding to by mentioning their name.

  3. #3
    Registered User
    Join Date
    04-02-2013
    Location
    california, usa
    MS-Off Ver
    Excel 2010
    Posts
    33

    Re: Delete all rows with yellow or blue

    Hello Dave, I am looking for a macro. I have many worksheets in an excel workbook and would like to have a macro that deletes all rows that do not have the color blue or yellow in them.

  4. #4
    Registered User
    Join Date
    04-02-2013
    Location
    california, usa
    MS-Off Ver
    Excel 2010
    Posts
    33

    Re: Delete all rows with yellow or blue

    I want to delete rows that do not contain cells that have a color (rows with colored cells are yellow and blue, but could also be red or green.
    So, I want a code that will delete rows that do not contain a colored cell. I used this code but it did not delete any rows. Is colorindex for no color 0 ?
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    08-15-2012
    Location
    Australia
    MS-Off Ver
    Excel 2016
    Posts
    349

    Re: Delete all rows with yellow or blue

    Maybe this, deletes all rows in column A that don't have color.
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    04-02-2013
    Location
    california, usa
    MS-Off Ver
    Excel 2010
    Posts
    33

    Re: Delete all rows with yellow or blue

    This code deleted all the rows. I'm trying to delete only rows that do not have colored cells.

  7. #7
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Delete all rows with yellow or blue

    I have a suspicion that you are using conditional formatting to color your cells. If that is the case then VBA is going to recognize your colored cells the same as your non colored cells. In other words, VBA and Conditional Formatting do not easily work together. It is possible just extremely challenging. Here is a resource on how to do it. http://www.cpearson.com/excel/cfcolors.htm


    Outside of that you could always use a worksheet_change event to color based upon values but that might take a lot of time too depending on how many parameters you have. Best of luck.

  8. #8
    Registered User
    Join Date
    04-02-2013
    Location
    california, usa
    MS-Off Ver
    Excel 2010
    Posts
    33

    Re: Delete all rows with yellow or blue

    The color is just applied using Fill color, and not conditional formatting. Does that help ?

  9. #9
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Delete all rows with yellow or blue

    Assuming column A:

    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    04-02-2013
    Location
    california, usa
    MS-Off Ver
    Excel 2010
    Posts
    33

    Re: Delete all rows with yellow or blue

    The code deletes all rows, even rows that contain cells with colorfill. I am not sure why.

  11. #11
    Forum Contributor
    Join Date
    08-15-2012
    Location
    Australia
    MS-Off Ver
    Excel 2016
    Posts
    349

    Re: Delete all rows with yellow or blue

    Put value/text into the cell and color it then run the macro again.

+ 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. Delete Row if the Font RGB is not 0, 0, 255(Blue)
    By Justair07 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 04-23-2014, 05:24 PM
  2. Replies: 2
    Last Post: 04-06-2014, 08:57 AM
  3. [SOLVED] delete all little yellow squares
    By johnandrews in forum Excel General
    Replies: 16
    Last Post: 12-20-2013, 10:13 AM
  4. VBA: If 2 cells in Row are yellow Delete last
    By mattress58 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-06-2013, 08:33 AM
  5. [SOLVED] Highlight Yellow Active Row, PROBLEM: row selected before closing stays yellow
    By NumberCruncher311 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-12-2013, 07:01 PM

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