When you post problems like this it makes it much easier if you could provide a sample workbook with no sensitive data as it makes it easier to write the code otherwise the person trying to answer your question may have to create their own workbook to test the code. There is a discrepency in your post because you say
Finds the matching cell in the column X2:X40 and the cell in the Range A2:U14.
then you go on to say
Changes the formatting of the cell background in X2:X40 to the same background color to its corresponding cell in A2:U40.
I am not sure if the range should be A2:U40 or A2:U14 so you will need to change the code accordingly to match your workbook.
Try this code - it should do what you need. Let me know if you have any problems - add the following code to a module and run matchVals
NOTE - Change A2:U14 to A2:U40 if latter is correct. Make sure you run this on backup as you cannot undo VBA code. Also change Sheet1 to the name of the sheet with the data.
Bookmarks