AW: Farbige Zellen zählen
09.07.2009 14:30:23
Hans
Hallo Erich,
nachstehend die für Deine Anforderung angepasste Formel:
Function CountCellColor(rng As Range, iColor As Integer) As Double
Dim rngAct As Range
Dim iCount As Integer
For Each rngAct In rng.Cells
If IsNumeric(rngAct.Value) Then
If rngAct.Interior.ColorIndex = iColor Then
iCount = iCount + 1
End If
End If
Next rngAct
CountCellColor = iCount
End Function
die Variable iColor ist die Nummer des Farbindexes. Du gibst die Formel in folgender Form ein:
=CountCellColor(A1:F16;13)
Die Farbindizes stellst Du fest über:
Sub Farben()
Dim i As Integer
For i = 1 To 56
Cells(i, 1).Interior.ColorIndex = i
Next i
End Sub