Ich habe in verschidene Zellen mit Farbe gefüllt. Nun möchte ich die verschiedenen Farben am Ende zusammenzählen.
zB. a1 = Gelb / a2 = Rot / a3 = Gelb
a4 = Resultat Total Gelb
a5 = Resultat Total Rot
Vielen Dank für die Hilfe
Ich habe in verschidene Zellen mit Farbe gefüllt. Nun möchte ich die verschiedenen Farben am Ende zusammenzählen.
zB. a1 = Gelb / a2 = Rot / a3 = Gelb
a4 = Resultat Total Gelb
a5 = Resultat Total Rot
Vielen Dank für die Hilfe
was die Anzahl oder die Summe??
In Zelle=Farbsumme(A1:A10;3)
Function Farbsumme(Bereich As Range, Farbe As Integer)
' Schriftfarb
Dim Zelle
Application.Volatile
For Each Zelle In Bereich
If Zelle.Font.ColorIndex = Farbe Then
Farbsumme = Farbsumme + Zelle
End If
Next
End Function
In Zelle=FarbsummeH(A1:A10;3)
Function FarbsummeH(Bereich As Range, Farbe As Integer)
' Hintergrund
Dim Zelle
Application.Volatile
For Each Zelle In Bereich
If Zelle.Interior.ColorIndex = Farbe Then
FarbsummeH = FarbsummeH + Zelle
End If
Next
End Function
Function Summe_Fett()
Application.Volatile
Dim I As Integer
For I = 5 To 36
If Cells(I, 1).Font.Bold = True Then
If Cells(I, 1) < Summe_Fett Then Summe_Fett = Cells(I, 1)
End If
Next
End Function
Function Farbsumme(Bereich As Range, Name As String, Farbe As Integer)
' Schriftfarbe nach Anzahl mit Suchbegriff
Dim Zelle
Dim I As Integer
Application.Volatile
For Each Zelle In Bereich
If Zelle.Font.ColorIndex = Farbe And Zelle = Name Then
I = I + 1
End If
Next
Farbsumme = Name & " " & I & " in Farbe " & Farbe
End Function
Anzahl der Zellen mit einer Farbe
' In Zelle=Farbsumme(A1:A10;3)
Function FarbsummeH(Bereich As Range, Farbe As Integer)
' Hintergrund
Dim Zelle
Application.Volatile
For Each Zelle In Bereich
If Zelle.Interior.ColorIndex = Farbe Then
FarbsummeH = FarbsummeH + 1
End If
Next
End Function
Gruß Hajo
Dim iZähler As Integer
Dim c As Range
For Each c In Range("A1:a5000")
If c.Font.ColorIndex = 3 Then 'siehe Online-Hilfe für Colorindex
iZähler = iZähler + 1
End If
Next
Cells(3, 7).Value = iZähler