How to access conditional formatting colors through VBA?

Hermanito

Well-known Member
Joined
Apr 4, 2007
Messages
1,238
Hey all,

I'm struggling with the following: I've got a nice table in Excel 2007 that pulls data from Access 2007, it's a Query Table, so it's dynamic. It also gets one of those fancy tablestyles of Excel 2007.
What I want to be able to do is determine in VBA what the effective background colors for certain cells are...
I know that
Code:
mySheet.Cells(1,1).Interior.Color
does not return conditional formatting color information, but googling and searching the helpfile informed me that
Code:
mySheet.Cells(1,1).FormatConditions(1).Interior.Color
should do just that.
The FormatConditions is a collection I need to loop through, there can be more than 1, and each can have a color, but when I try that code, I always get an empty FormatConditions collection back, even though the cells do have background colors...
What am I doing wrong here?

grts,
H
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Hehe, I'm usually the first one to refer to Chip Pearson's site... I should have checked there myself...

But... unfortunately the code does not help me... I used the functions as shown there, and the FormatConditions collection still remains empty. I stepped through the code and it seems there are no conditions applied to my cells.
Which in a way makes sense when I think about it. After all, those fancy tableformattings in 2007 are apparently styles, and not conditional formatting.
I've googled on for Styles and TableStyles, but I haven't found the solution yet... when I check my worksheet for TableStyles, it says there are 144 styles. I do not want to have to loop through them all to find the color of the range I'm working with.
 
Upvote 0

Forum statistics

Threads
1,216,170
Messages
6,129,277
Members
449,498
Latest member
Lee_ray

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