+ Reply to Thread
Results 1 to 5 of 5

Copy a row to another sheet based on cell fill color

  1. #1
    Registered User
    Join Date
    10-19-2012
    Location
    Dayton, OH
    MS-Off Ver
    Excel 2010
    Posts
    5

    Copy a row to another sheet based on cell fill color

    I'm sure that this has been covered before but I can't seem to find it. I want a macro that will copy an entire row from one sheet to another based on the fill color of one cell. Since I will be continually adding to the main sheet this will need to copy to the next empty row when it runs.

    In my sample attachment, if the cell is green I want the row copied to the "Good" sheet and if it is red to the "Bad" Sheet.

    Thanks for any help.

    Steve
    Attached Files Attached Files
    Last edited by swatkins1977; 10-19-2012 at 04:36 PM.

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Copy a row to another sheet based on cell fill color

    Please Login or Register  to view this content.
    If solved remember to mark Thread as solved

  3. #3
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Copy a row to another sheet based on cell fill color

    Try pasting the following copy into the specified sheets in the VBA editor (Alt F11)

    Into Sheet2(Good)

    Please Login or Register  to view this content.
    Into Sheet3(Bad)

    Please Login or Register  to view this content.
    The code works by regenerating the good and bad sheets every time that they are activated so that they are always in sync with the Log sheet.
    Martin

  4. #4
    Registered User
    Join Date
    10-19-2012
    Location
    Dayton, OH
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Copy a row to another sheet based on cell fill color

    Thanks for the help. Martin, your solution is copying over as I want but it pastes it down below any row that has been previously used so every time it copies it goes further down the sheet and leaves all the rows above it empty. Any ideas on this?

    It is actually working better than I had hoped with the exception of pasteing so far down.

    Thanks,

    Steve
    Last edited by swatkins1977; 10-22-2012 at 07:30 AM.

  5. #5
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Copy a row to another sheet based on cell fill color

    OK - Try Cells.Delete as the first row in both pieces of code.

+ 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