AW: Meist verwendete Zellhintergrundfarbe ermitteln
Matthias
Hallo Martin,
folgender Code schreibt die Häufigkeiten und die Farbindizies in 2 Hilfsspalten (hier 5 und 6).
Sub Hintergrund()
Const Hilfsspalte = 5 'und die nächste (hier 6)
Dim a(57) As Integer, i As Integer, j As Integer
Dim z As Range, f As Long
For Each z In Selection
f = z.Interior.ColorIndex
If f >= 0 Then a(f) = a(f) + 1
Next z
j = 2
Range(Cells(2, Hilfsspalte), Cells(70, Hilfsspalte + 1)).ClearContents
For i = 0 To 57
If a(i) > 0 Then
Cells(j, Hilfsspalte + 1) = i '1. Hilfsspalte: Farbe
Cells(j, Hilfsspalte) = a(i) '2. Hilfsspalte: Häufigkeit
j = j + 1
End If
Next i
End Sub
in die erste Zeile kann die Formel für das Maximun:
in E1: =MAX(E2:E60)~f~
in F1: ~f~=SVERWEIS(E1;E2:F160;2;FALSCH)
Dann hast du in F1 den meistgebrauchten Farbindex
Hoffe, das hilft Dir weiter.
Gruß Matthias