Copy and Paste only colors from Table 1 to Table 2 considering corresponding cells.

learningstatistics

Board Regular
Joined
Dec 3, 2015
Messages
56
Hello,

I have two tables. Left table and right table. What I want is to copy only the color of a certain cell from the right table to its corresponding cell in the left table.
So, cell (C,2018) is red in the right table so (C,2018) should be red in the left too.
Cell (A, 2021) is pink in the right table so (A,2021) should be pink in the left too.
Cell(A,2018) is white in the right table so (A,2018) should be white in the left too.
Please ignore the yellow part of the table.

1600043692354.png


Thank you!!!
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Hello,

Does this work as expected?

VBA Code:
Sub COLOUR_LEFT_TABLE()
    Columns("B:F").Interior.ColorIndex = xlNone
    For MY_ROWS = 2 To Range("A" & Rows.Count).End(xlUp).Row
        For MY_COLS = 16 To 20
            If Not (Cells(MY_ROWS, MY_COLS).Interior.ColorIndex) = xlNone Then
                MY_COLOUR = Cells(MY_ROWS, MY_COLS).Interior.ColorIndex
                Cells(MY_ROWS, MY_COLS - 14).Interior.ColorIndex = MY_COLOUR
            End If
        Next MY_COLS
    Next MY_ROWS
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,651
Messages
6,120,738
Members
448,988
Latest member
BB_Unlv

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top