farbige Buchstaben zählen
13.08.2003 14:32:56
Jürg
Habe dieses VBA bekommen:
Function CountColor(rng As Range, iColor As Integer)
Dim rngAct As Range
Dim iCount As Integer
Application.Volatile
For Each rngAct In rng.Cells
If rngAct.Interior.ColorIndex = iColor Then
iCount = iCount + 1
End If
Next rngAct
CountColor = iCount
End Function
Sub fonttest()
Dim r As Range, i As Integer
Set r = Cells(1, 1)
For i = 1 To r.Characters.Count
Debug.Print r.Characters(i, 1).Text
Debug.Print r.Characters(i, 1).Font.ColorIndex
Next
End Sub
Es funktioniert gut! nun möchte ich noch einzelne Buchstaben pro Zelle zählen können z.B. in A1 steht geschrieben: 3x "X" in rot und 2x "X" in Blau. Nun möchte ich in A10 für "X" eine 2 stehen für 2x "X" in blau und in A11 eine 3 für 3x Xrot Kann man da noch was hinzufügen?
Viel Dank
mit Gruss
Jürg