+ Reply to Thread
Results 1 to 6 of 6

Delete Rows That Have a Color Red in Cell

  1. #1
    Forum Contributor
    Join Date
    12-22-2004
    Location
    Kokomo, Indiana
    Posts
    236

    Delete Rows That Have a Color Red in Cell

    Group,
    Have a spreadsheet with several hundred rows. I'm running Windows XP and Excel 2007. Have data in columns A thru I. In column D I have Conditional Formatting that changes each cells color in D to either Green, Yellow or Red. How can VBA delete an entire row if the cell in column D is Red? When I run the macro, any row with red in its D column cell will be deleted.
    Last edited by VBA Noob; 01-01-2009 at 03:16 PM.

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    What condition triggers the change in colour as that would be easier to work with

    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  3. #3
    Forum Contributor
    Join Date
    12-22-2004
    Location
    Kokomo, Indiana
    Posts
    236

    Question

    If the value of a cell in col g equals the letters red, the first cell turns red. I guess I should have asked how to delete a row if another cell has the letters red. Does that make sense?

  4. #4
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Link has lots of examples

    http://www.rondebruin.nl/delete.htm

    think the quickest would be autofilter

    http://www.rondebruin.nl/delete.htm#AutoFilter

    Post back if you need help

    VBA Noob

  5. #5
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573
    No cell just turns red. It turns by a Conditional Format or a Change event. The first requires some special macros. The 2nd method is easier.

    For either method, it is easier to just add a column that results in a True or False value or some other value. One then deletes based on it. The formula is what governs turning the "cell red". Once you have that column added, one of Ron's methods will complete the project.

  6. #6
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    This will delete all rows where a cell in Column G starts with red.

    Please Login or Register  to view this content.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

+ 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