Saving Cell Interior Color to a variable

millhouse123

Active Member
Joined
Aug 22, 2006
Messages
335
I am trying to determine the color of a particular cell and then formating a respective cell in another worksheet with the same color.

I have been trying to use

Code:
Frank = WS2.Cells(X, Y).Interior.ColorIndex

This cell has conditional formatting -

using the above code returns the number -4142 as the index number when I would expect it to return 6.

Does conditional formatting effect how the line of code above would work? If so how might I solve this problem.

Thanks
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
-4142 is what you will get for the interior of a blank cell not one coloured yellow with conditional formatting which doesn't effect the interior colorindex of the cell.

You would basically need to test for the same logical test as the conditional formatting.

Dom
 
Upvote 0

Forum statistics

Threads
1,213,483
Messages
6,113,919
Members
448,533
Latest member
thietbibeboiwasaco

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