AW: Farbfunktion wenn Bedingung erfüllt
20.02.2009 14:09:00
Katja
Hallo Hajo,
der Code für die Farbfunktion lautet:
Public Function AnzahlRot(Bereich As Object) As Double
Dim s As Double
Dim a As Object
Application.Volatile
s = 0
For Each a In Bereich
If a.Interior.ColorIndex = 3 Then
s = s + 1
End If
Next
AnzahlRot = s
End Function
Public Function AnzahlSchwarz(Bereich As Object) As Double
Dim s As Double
Dim a As Object
Application.Volatile
s = 0
For Each a In Bereich
If a.Interior.ColorIndex = 1 Then
s = s + 1
End If
Next
AnzahlSchwarz = s
End Function
Public Function AnzahlGrau(Bereich As Object) As Double
Dim s As Double
Dim a As Object
'Grau 50%
Application.Volatile
s = 0
For Each a In Bereich
If a.Interior.ColorIndex = 16 Then
s = s + 1
End If
Next
AnzahlGrau = s
End Function
Public Function AnzahlBlau(Bereich As Object) As Double
Dim s As Double
Dim a As Object
Application.Volatile
s = 0
For Each a In Bereich
If a.Interior.ColorIndex = 5 Then
s = s + 1
End If
Next
AnzahlBlau = s
End Function
Hoffe, es hilft Dir weiter. Danke schonmal.
Gruß
Katja