Farben und Werte
11.04.2005 15:40:08
Michel
habe in meiner Tabelle (Spalte A) Formelwerte aus anderen Tabellen. Wenn in dieser Spalte A nun die Begriffe "Mannheim" und/oder "Heidelberg" auftauchen, soll die Schriftart Rot, Fett und Unterstrichen sein.
Mit folgendem Code funkt es, wenn NUR die Worte in der Spalte A stehen - also keine Formelwerte...
what can I do?
Function faerben()
suchen1 = "Mannheim"
suchen2 = "Heidelberg"
Set Bereich = Worksheets(ActiveSheet.Name).Range("A:A")
Bereich.Font.ColorIndex = 1
Bereich.Font.Underline = False
Bereich.Font.Italic = False
Bereich.Font.Bold = True
With Bereich
Set c = .Find(suchen1, lookat:=xlWhole)
If Not c Is Nothing Then
firstAddress = c.Address
Do
c.Font.ColorIndex = 3
c.Font.Underline = True
c.Font.Italic = True
c.Font.Bold = True
c.Font.Size = 11
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> firstAddress
End If
Set c = .Find(suchen2, lookat:=xlWhole)
If Not c Is Nothing Then
firstAddress = c.Address
Do
c.Font.ColorIndex = 3
c.Font.Underline = True
c.Font.Italic = True
c.Font.Bold = True
c.Font.Size = 11
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> firstAddress
End If
End With
End Function