Is there a way to check if a range of cells have a certain conditioning format on them such as cell is highlighted if blah blah blah... ?
-
How to you want to check it - manually or programatically?– TechieApr 28, 2016 at 13:34
-
programmatically - vba– user582635Apr 28, 2016 at 14:03
-
If it's related to programming, it should be on stackoverflow.com– TechieApr 28, 2016 at 14:18
-
@namish Please note that scripting questions (VBA/cmd/PowerShell/bash ...) are very much on topic on Super User.– DavidPostill ♦Apr 29, 2016 at 7:43
Add a comment
|
1 Answer
Select the cells you wish to examine and run:
Sub fourmat()
Dim r As Range, msg As String
msg = ""
For Each r In Selection
msg = msg & vbCrLf & r.Address(0, 0) & vbTab & r.FormatConditions.Count
Next r
MsgBox msg
End Sub
It will list each cell and the number of conditional formats associated with that cell:
EDIT#1:
You can test the current state of a cell's format with the Range.DisplayFormat property, but you will need to be able to associate a specific part of the format to a specific condition.
For example, it will tell you if the cell is Bold, but you must know what condition made it bold!
-
-
@user582635 You can replace
Selection
with any range you like...........or you can re-code to pass the range to the sub..................if you don't want the result in aMsgBox
, you can pass the string to another sub or return it............??............. your choice Apr 28, 2016 at 14:22 -
umm. the code shows if the cells have conditioning format, I want to see if the conditioning format is activated. like all the selection cells have conditioning formats but I want to know which cell(s)'s conditioning formatting is active. Apr 28, 2016 at 14:26
-
@user582635 Sorry...........I don't know how to do that without evaluating each possible condition for each formatted cell.............sorry......... Apr 28, 2016 at 14:29
-
@user582635 See my update to my answer..............it should get you part the way there. Apr 28, 2016 at 14:35