+ Reply to Thread
Results 1 to 17 of 17

Match color between two sheets, if not match highlight with different color

  1. #1
    Forum Contributor
    Join Date
    07-09-2013
    Location
    Nagpur, India
    MS-Off Ver
    Excel 2010 / 2013
    Posts
    293

    Match color between two sheets, if not match highlight with different color

    Hi,

    I've two workbooks in which some cells of column D of both the workbooks are in yellow filled color.
    I wants following things :
    If the colored cell of column D of workbook 1 is not in the same color in workbook 2 then highlight the cell of column C in workbook 2.
    If the colored cell of column D of workbook 2 is not in the same color in workbook 1 then highlight the cell of column C in workbook 1.

    Please refer the file attached. Thanks


    - Abhinav
    Attached Files Attached Files

  2. #2
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: Match color between two sheets, if not match highlight with different color

    This code will work, but the cells coloured "Yellow" in the 2 sheets are different "Yellows" !!
    This means all the yellow cells will be coloured "Red" in column "C" of both sheets, along with the Mismatched coloured cells.
    NB:- The workbooks are called "book1", and "book2"
    Please Login or Register  to view this content.
    Regards Mick

  3. #3
    Forum Contributor
    Join Date
    07-09-2013
    Location
    Nagpur, India
    MS-Off Ver
    Excel 2010 / 2013
    Posts
    293

    Re: Match color between two sheets, if not match highlight with different color

    I think it is not working.

    Now I've attached 2 new workbooks with the exact same yellow color code.

    Please help sir.
    Attached Files Attached Files

  4. #4
    Forum Contributor
    Join Date
    07-09-2013
    Location
    Nagpur, India
    MS-Off Ver
    Excel 2010 / 2013
    Posts
    293

    Re: Match color between two sheets, if not match highlight with different color

    Quote Originally Posted by abhinavbinkar View Post
    I think it is not working.

    Now I've attached 2 new workbooks with the exact same yellow color code.

    Please help sir.
    PS: The colored cells on both workbooks were done through Conditional Formatting.

  5. #5
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: Match color between two sheets, if not match highlight with different color

    Try this:-
    Please Login or Register  to view this content.
    Regards Mick

  6. #6
    Forum Contributor
    Join Date
    07-09-2013
    Location
    Nagpur, India
    MS-Off Ver
    Excel 2010 / 2013
    Posts
    293

    Re: Match color between two sheets, if not match highlight with different color

    Thank you so much Mick. It is now working.

    Can you please help me one last time if it is possible, as my file names for comparison are different daily.

    "Book2.xlsx" actual file name is in the format as : ECOM STATUS - DD-MM-YY.xlsx and path for this file is:
    BOOK2.xlsx = "C:\Users\MRF LTD\Desktop\ECOM DAILY\ECOM STATUS - 02-04-18.xlsx"

    "Book1.xlsx" actual file name is in the format as : ECOM STATUS - DD-MM-YY(Today - 1 day i.e. previous date).xlsx and path for this file is:
    BOOK1.xlsx = "C:\Users\MRF LTD\Desktop\ECOM DAILY\ECOM STATUS - 01-04-18.xlsx"

    Please help sir.

    - Abhinav
    Last edited by abhinavbinkar; 04-03-2018 at 01:16 AM. Reason: typing error

  7. #7
    Forum Contributor
    Join Date
    07-09-2013
    Location
    Nagpur, India
    MS-Off Ver
    Excel 2010 / 2013
    Posts
    293

    Re: Match color between two sheets, if not match highlight with different color

    Quote Originally Posted by abhinavbinkar View Post
    Thank you so much Mick. It is now working.

    Can you please help me one last time if it is possible, as my file names for comparison are different daily.

    "Book2.xlsx" actual file name is in the format as : ECOM STATUS - DD-MM-YY.xlsx and path for this file is:
    BOOK2.xlsx = "C:\Users\MAV LTD\Desktop\ECOM DAILY\ECOM STATUS - 02-04-18.xlsx"

    "Book1.xlsx" actual file name is in the format as : ECOM STATUS - DD-MM-YY(Today - 1 day i.e. previous date).xlsx and path for this file is:
    BOOK1.xlsx = "C:\Users\MAV LTD\Desktop\ECOM DAILY\ECOM STATUS - 01-04-18.xlsx"

    Please help sir.

    - Abhinav
    Is it possible that both the files to open automatically and to run that macro code for comparison.

  8. #8
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: Match color between two sheets, if not match highlight with different color

    Try this:-
    NB:- See code Notes.
    Please Login or Register  to view this content.
    Regards Mick

  9. #9
    Forum Contributor
    Join Date
    07-09-2013
    Location
    Nagpur, India
    MS-Off Ver
    Excel 2010 / 2013
    Posts
    293

    Re: Match color between two sheets, if not match highlight with different color

    Untitled1.jpg

    When i debug the code it is appearing as :

    Untitled2.png

    Please help.

  10. #10
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: Match color between two sheets, if not match highlight with different color

    I Imagine its because your file path and file name are not the same as the one you are trying to open.
    NB:- When the code fails on the line "Workbook.open" , then above it you will see the variable "tpth1" hold your curser over it to read the Path and file name, check this line to ensure it is the Exactly same as the one you are trying to open.
    If the paths are different change the code path (where previously shown in code) to the correct path
    Last edited by MickG; 04-02-2018 at 09:22 AM.

  11. #11
    Forum Contributor
    Join Date
    07-09-2013
    Location
    Nagpur, India
    MS-Off Ver
    Excel 2010 / 2013
    Posts
    293

    Re: Match color between two sheets, if not match highlight with different color

    The path in that code is different. The path is showing in variable "tpth1" is that folder where the "PERSONAL.xlsb" file is located.
    How to change that path to where my actual files are stored at desktop ECOM DAILY folder.

    Untitled3.png

    My correct path is "C:\Users\MRF LTD\Desktop\ECOM DAILY\ECOM STATUS - DD-MM-YY.xlsx"

    Regards,
    Abhinav

  12. #12
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: Match color between two sheets, if not match highlight with different color

    Change path in code as shown below:-
    When changed, step through code "F8" to see if the path and the file name are correct.
    When correct change other path for "Pth2"
    Please Login or Register  to view this content.

  13. #13
    Forum Contributor
    Join Date
    07-09-2013
    Location
    Nagpur, India
    MS-Off Ver
    Excel 2010 / 2013
    Posts
    293

    Re: Match color between two sheets, if not match highlight with different color

    WOW!!! That worked like a charm. Truly you're a genius Mick.
    Thank you so much for your valuable efforts. God bless you.

  14. #14
    Forum Contributor
    Join Date
    07-09-2013
    Location
    Nagpur, India
    MS-Off Ver
    Excel 2010 / 2013
    Posts
    293

    Re: Match color between two sheets, if not match highlight with different color

    Hey Mick, I now just required that it should clear all the filled color and conditional formatting from "Column C" in both the files before running that code and start comparing.

    Regards,
    Abhinav

  15. #15
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: Match color between two sheets, if not match highlight with different color

    As the conditional formatting is in columns "D", I take it that you mean the Cells coloured red from the running of the code:-
    Add Red lines in Code:-

    Please Login or Register  to view this content.

  16. #16
    Forum Contributor
    Join Date
    07-09-2013
    Location
    Nagpur, India
    MS-Off Ver
    Excel 2010 / 2013
    Posts
    293

    Re: Match color between two sheets, if not match highlight with different color

    Thank you so so so so sooooo... much Mick for the help.

  17. #17
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: Match color between two sheets, if not match highlight with different color

    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. How to make the fill color of 2 column in separate sheets match
    By Siegetrain in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-17-2018, 03:51 PM
  2. Replies: 4
    Last Post: 08-19-2015, 04:17 PM
  3. [SOLVED] Click oval option button to fill/unfill color, also change border color to match fill
    By Rocky2013 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-07-2015, 08:29 PM
  4. How to use color Index VBA to match cell color in first tab to the second tab
    By susanliu in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-29-2014, 06:55 PM
  5. Replies: 2
    Last Post: 02-04-2013, 02:00 PM
  6. Set chart series color to match series legend entries font color
    By Equipoise in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-03-2013, 07:33 AM
  7. Replies: 12
    Last Post: 09-18-2012, 03:13 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