counting formatted cells in vba

  • Thread starter Thread starter Simon Lloyd
  • Start date Start date
S

Simon Lloyd

Can anyone help with this? i am trying to count all cells in one colum
formatted a certain colour, here is what i have...it counts all th
cells until the date i have given it and returns that figure but is no
singling out the certain coloured ones....hope you can help!

Sub colorcount()
'
' colorcount Macro
' Macro recorded 22/04/04 by simon
'
' Keyboard Shortcut: Ctrl+Shift+k
Dim ccount As Integer
Range("a9").Select
Do Until ActiveCell = "31/12/2004"
ActiveCell.Offset(1, 0).Select
Select Case ActiveCell.Offset(0, 0).FormatConditions.Count
Case Is = ColorIndex = 38
ccount = ccount + 1
End Select
Loop
MsgBox "There Are " & ccount & " Holiday Clashes"


End Sub

Simon
 
Take a look at Chip Pearson's site:
http://www.cpearson.com/excel/CFColors.htm

He has some code there that'll do what you want.

But if I were the developer of the workbook, then I'd know what those
conditional formatting formulas/rules were. I'd try to use those same rules in
code.

To me, it's a lot simpler.
 
Back
Top