How to get the Interior.Color value in one cell to change the Interior.color value of a different cell

Computerman

Board Regular
Joined
Mar 3, 2016
Messages
91
I am writing code to have multiple worksheets update a master worksheet and need to find a way to have the Interior.Color value in cells in one spreadsheet cause the corresponding cell in a different spreadsheet have the same Interior.color.
here is the code I have so far:
Code:
Option Explicit
Dim LastRow As Long
Dim wb As Workbook
Dim x As Integer
Dim y As Integer

Private Sub cmdSync_Click()
'determine the last row of the Master Worksheet
For Each wb In Application.Workbooks
    If wb.Name = "KAR process tracker - Master.xlsm" Then
        LastRow = wb.Sheets("Sheet1").Range("A65536").End(xlUp).Row
        For x = 2 To LastRow
            wb.Sheets("Sheet1").Range("A" & x).Value = Range("A" & x).Value
            wb.Sheets("Sheet1").Interior.Color = Range("A" & x).Interior.Color
            
        Next x
    End If
Next wb
End Sub
it fails on the Interior.color line. It is only checking for column A at the moment, once I get that working then I will check the rest of the rows, currently out to AF but that is likely to change.

thank you,
Computerman
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
"Interior" refers to the interior of a cell, but you haven't specified a cell (on the left of the equal sign) in the line that fails.
 
Upvote 0
This part here does not reference a cell object to determine it's interior.color, compare to the line above:
Rich (BB code):
wb.Sheets("Sheet1").Range("A" & x).Value = Range("A" & x).Value
wb.Sheets("Sheet1").Range("A" & x).Interior.Color = Range("A" & x).Interior.Color
Your code assumes the active sheet the macro is executed from has the same number of rows in column A, Sheet1 of KAR Process tracker - Master.xlsm?

Are you trying to make the KAR Process tracker's interior cell colour in column A match that as the activesheet?
 
Upvote 0

Forum statistics

Threads
1,224,811
Messages
6,181,081
Members
453,021
Latest member
Justyna P

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