+ Reply to Thread
Results 1 to 12 of 12

Delete Row Based on Color

  1. #1
    Forum Contributor
    Join Date
    06-15-2013
    Location
    United States
    MS-Off Ver
    Excel 2016
    Posts
    213

    Delete Row Based on Color

    Quick question, Does anybody know a macro that will search all of Column A and Delete the Rows that contain the cell color Red in Column A? Thanks for any help.

  2. #2
    Forum Expert
    Join Date
    10-09-2014
    Location
    Newcastle, England
    MS-Off Ver
    2003 & 2013
    Posts
    1,986

    Re: Delete Row Based on Color

    Please Login or Register  to view this content.
    will check the 1st 1000 rows, you'll need to amend the loop for your code etc

  3. #3
    Forum Contributor
    Join Date
    06-15-2013
    Location
    United States
    MS-Off Ver
    Excel 2016
    Posts
    213

    Re: Delete Row Based on Color

    Thanks for the reply. I'm getting a compile error at
    Please Login or Register  to view this content.

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Delete Row Based on Color

    Hello trevor2524,

    That depends on how the color was generated (manually or conditional formatting) and which version of Excel is running the macro.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  5. #5
    Forum Contributor
    Join Date
    06-15-2013
    Location
    United States
    MS-Off Ver
    Excel 2016
    Posts
    213

    Re: Delete Row Based on Color

    It was created by another macro. And I'm using Excel 2013.

  6. #6
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Delete Row Based on Color

    Hello trevor2524,

    Was this macro also created using Excel 2013 or an earlier version?

  7. #7
    Forum Contributor
    Join Date
    06-15-2013
    Location
    United States
    MS-Off Ver
    Excel 2016
    Posts
    213

    Re: Delete Row Based on Color

    It was also created using Excel 2013. Here is the code I used to find the duplicates and mark them as red.
    Please Login or Register  to view this content.

  8. #8
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Delete Row Based on Color

    Hello trevor2524,

    Have you verified your cell's color is a true red RGB(255, 0, 0) and not some custom shade of red?

    Please Login or Register  to view this content.

  9. #9
    Forum Contributor
    Join Date
    06-15-2013
    Location
    United States
    MS-Off Ver
    Excel 2016
    Posts
    213

    Re: Delete Row Based on Color

    Hello Leith,
    The cells are the color that the macro sets. I don't have it running anything else against the cells. The macro you sent over almost works. For some reason its leaving one of the rows that are marked red.

  10. #10
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Delete Row Based on Color

    Hello trevor2524,


    The cell's color is probably a custom red and not a true red RGB(255, 0, 0).

    You can check by:
    1) Right Click the cell and select Format Cells...
    2) Click the Fill tab
    3) Click the More Colors... button below the color table.

  11. #11
    Forum Contributor
    Join Date
    06-15-2013
    Location
    United States
    MS-Off Ver
    Excel 2016
    Posts
    213

    Re: Delete Row Based on Color

    It's showing up as Red. I just ran the macro 4 more times after the initial run to remove all the red rows. So it works that way. Thanks for the help.

  12. #12
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Delete Row Based on Color

    Hello trevor2524,

    You're welcome.

+ 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 a row based on color of cell
    By karimretina in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-25-2014, 05:18 AM
  2. [SOLVED] Delete row based on red color font
    By Jhon Mustofa in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-02-2014, 10:02 AM
  3. Delete Columns Based On Fill Color
    By jlkirk in forum Excel General
    Replies: 7
    Last Post: 01-28-2013, 02:00 PM
  4. delete rows based on fill color
    By schueyisking in forum Excel General
    Replies: 1
    Last Post: 08-25-2008, 10:28 AM
  5. Delete Rows Based On Color
    By Tommyweather in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-01-2008, 04:24 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