Catherine
Catherine

Reputation: 33

Excel VBA : Use the color of a shape in an If/Then case

I have created a chart on Excel using macros. Each of the shapes on the chart is filled with a color according to its category. I was wondering if it is possible to use the color of the shapes in an If/Then case to perform different actions, such as displaying the shapes with specific colors only. For example, something similar to:

If shape.Fill.ForeColor.SchemeColor = 1 Then
   shape.delete

I have tried that, but it doesn't seem to do anything to my chart. Does anyone have an idea of how to do it?

Thank you !!

Upvotes: 0

Views: 689

Answers (1)

Slaqr
Slaqr

Reputation: 563

Did you try checking the color with the corresponding RGB value? Since SchemeColor depends on the current color scheme it might be looking for a different color than you'd expect

Upvotes: 3

Related Questions