I would like VBA
code to print every condition formatting Rule within a spreadsheet, including Rule Type, Rule Description (formula), Colour and Cell Range that the rule applies to.
How do I achieve this?
相关问题
- Excel sunburst chart: Some labels missing
- Error handling only works once
- Error handling only works once
- Excel formula in VBA code
- Excel VBA run time error 450 from referencing a ra
相关文章
- Get column data by Column name and sheet name
- programmatically excel cells to be auto fit width
- Unregister a XLL in Excel (VBA)
- Unregister a XLL in Excel (VBA)
- How to prevent excel from truncating numbers in a
- numeric up down control in vba
- Declare a Range relative to the Active Cell with V
- What's the easiest way to create an Excel tabl
Rosetta's answer is good, but I think it's important to know the Operator (greater than, less than, etc.), so I modified it:
u can list it like this, quite easily.
buts its buggy as certain type cannot be list using this way so you need to trap the error and find other ways to list the errornous type.
Rosetta's answer is good for typical FormatConditions that are based on expressions but Excel supports other conditional formatting types which were not handled by that routine and caused errors. Here is an updated routine that lists all the conditions on the active sheet. I don't list the details for every type but you can add more as needed. Note that the
cf.Operator
property only exists on some expressions so I did not include it.The main difference that makes this code work is the cf variable needs to be declared as Object because
Cells.FormatConditions
can return multiple data types.Example output