There's much better VBA code for this, I'm sure, but as a non-VBA person, I'd currently use conditional formatting and COUNTA :
rather than shade your vacations, put a "1" in the relevant days
then conditional format the range so that if the cell value is not equal to 0, the font is pink and the background pattern is pink (effectively shading the whole cell) - this will give you pink ranges of vacation days
then use =COUNTA to count non-blank cells on each person's vacation range
Pretty ameuter, I know !
HTH
Chris
Hello,
There isn't a built in function to count colours in Excel. However, it's easy to implement using a bit of VBA to create a UDF.
Function CountShadedCells(CountRange As Range) As Long
'Function to count the number of shaded cells in the
'selected range.
Dim rngeCell As Range
For Each rngeCell In CountRange.Cells
If rngeCell.Interior.ColorIndex <> xlColorIndexNone Then
CountShadedCells = CountShadedCells + 1
End If
Next
End Function
Hope this helps,
D.
I posted this UDF on Wednesday
14070.html
Juan Pablo G.