771 Aufrufe
Gefragt in Tabellenkalkulation von
Hallo zusammen,

wie kann man erreichen, dass ein über "Bearbeiten/Suchen" gefundenes Wort (Exceltabelle mit Textpassagen) in einer Farbe (z.B. gelb) markiert wird.

Dank euch für eine Antwort.

Gruß Meli

1 Antwort

0 Punkte
Beantwortet von fedjo Experte (2.2k Punkte)
Hallo Meli,
vielleicht mit einem Makro:

Sub Suchen()
Dim strName As String, strTest As String
Dim strStartBlatt As String
strStartBlatt = ActiveSheet.Name
On Error GoTo Fehler
strTest = Sheets(strName).Name
GoTo anf:
Fehler:
Dim rngZelle As Range
ActiveWorkbook.Worksheets(strStartBlatt).Activate
Dim strSuchbegriff As String
anf:
strSuchbegriff = InputBox("Suchbegriff:")
If strSuchbegriff <> "" Then
With ActiveSheet.UsedRange
Set rngZelle = .Find(strSuchbegriff, LookIn:=xlValues, MatchCase:=False)
If Not rngZelle Is Nothing Then
firstAddress = rngZelle.Address
Do
rngZelle.Interior.Color = 65535
Set rngZelle = .FindNext(rngZelle)
Loop While Not rngZelle Is Nothing And rngZelle.Address <> firstAddress
End If
End With
If rngZelle Is Nothing Then
If MsgBox("Suchwert nicht gefunden ! Neue Suche ?", vbInformation + vbYesNo) = vbYes Then
GoTo anf:
End If
End If
End If
Set rngZelle = Nothing
End Sub

Gruß
fedjo
...