Interior.Color not working

londonwalsall

New Member
Joined
Oct 3, 2011
Messages
3
I have the following bit of code for changing the fill color of a shape to match that of a cell color. I thought it was working but when I revisited and modified the cell color to a dark red, I find the shape goes to light blue instead. The conditional formatting and cell references are all correct.

Selection.ShapeRange.Fill.ForeColor.RGB = Data.Cells(25,10).FormatConditions(cfValue).Interior.Color
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Can you use ColorIndex instead (Not Tested)

Code:
Selection.ShapeRange.Fill.ForeColor.ColorIndex= Data.Cells(25,10).Interior.ColorIndex
 
Upvote 0
No the colorIndex is not a member of the Colorformat object. Futhermore even if it was, my understanding (and I may be wrong here) is that colorIndex only lets me grab a color that is part of the 56 color palette; but what if the user modfiies the color of the cell and defines their own rgb fill color for it?
 
Upvote 0
Is light blue the correct colour for a different conditional format on the cell in question?
 
Upvote 0
Very good question - and one that's helped me solve it.

The answer was yes it was. Which led me to realize that I needed to order my conditional formats in a partciular order.

So I had a cell which would have a number between 1 and 5.
Then the conditional format for the cell in question would read this number and assign a color based on the value (If x=1 then ...)

I was also using this number is my formula above (cfValue).

However; what I neede to do was make sure my x=1 conditional format was the very first one in the list; x=2 being the second and so on.

Thanks very much for your prompt help!
 
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,730
Members
452,939
Latest member
WCrawford

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