Sub NamenFettMarkieren()
Dim wsPublikationen As Worksheet
Dim wsTabelle2 As Worksheet
Dim zelle As Range
Dim nameZelle As Range
Dim name As String
Dim startPos As Long
Set wsPublikationen = ThisWorkbook.Sheets("Publikationen")
Set wsTabelle2 = ThisWorkbook.Sheets("Tabelle2")
' Durch alle Zellen in Spalte A von "Publikationen" iterieren
For Each zelle In wsPublikationen.Range("A1:A100") ' Passen Sie den Bereich nach Bedarf an
If zelle.Value <> "" Then
' Durch alle Namen in "Tabelle2" iterieren
For Each nameZelle In wsTabelle2.Range("A1:A100") ' Passen Sie den Bereich nach Bedarf an
If nameZelle.Value <> "" Then
name = nameZelle.Value
startPos = InStr(1, zelle.Value, name, vbTextCompare)
' Wenn der Name gefunden wird
While startPos > 0
zelle.Characters(startPos, Len(name)).Font.Bold = True
startPos = InStr(startPos + Len(name), zelle.Value, name, vbTextCompare)
Wend
End If
Next nameZelle
End If
Next zelle
End Sub
Sub markierenInSpalteA()
Dim i&, j&, iStart&, iLang&, arrM(): arrM = Tabelle2.UsedRange
With Tabelle1
For i = 4 To .Cells(Rows.Count, 1).End(xlUp).Row
For j = LBound(arrM) To UBound(arrM)
If InStr(1, .Cells(i, 1), arrM(j, 1), vbTextCompare) > 0 Then
iStart = InStr(1, .Cells(i, 1), arrM(j, 1), vbTextCompare)
iLang = Len(arrM(j, 1))
.Cells(i, 1).Characters(Start:=iStart, Length:=iLang).Font.FontStyle = "Fett"
End If
Next j
Next i
End With
End Sub
Sub kopierenMarkierenInSpalteC()
Dim i&, j&, iStart&, iLang&, arrM(): arrM = Tabelle2.UsedRange
With Tabelle1
For i = 4 To .Cells(Rows.Count, 1).End(xlUp).Row
'.Cells(i, 3) = .Cells(i, 1) 'falls erforderlich
For j = LBound(arrM) To UBound(arrM)
If InStr(1, .Cells(i, 1), arrM(j, 1), vbTextCompare) > 0 Then
iStart = InStr(1, .Cells(i, 1), arrM(j, 1), vbTextCompare)
iLang = Len(arrM(j, 1))
.Cells(i, 3).Characters(Start:=iStart, Length:=iLang).Font.FontStyle = "Fett"
End If
Next j
Next i
End With
End Sub
Option Explicit
Sub markierenInSpalteA()
Dim i&, j&, arrM(): arrM = Tabelle2.UsedRange
For i = 4 To Tabelle1.Cells(Rows.Count, 1).End(xlUp).Row
For j = LBound(arrM) To UBound(arrM)
If InStr(1, Tabelle1.Cells(i, 1), arrM(j, 1), vbTextCompare) > 0 Then Tabelle1.Cells(i, 1).Characters(Start:=InStr(1, Tabelle1.Cells(i, 1), arrM(j, 1), vbTextCompare), Length:=Len(arrM(j, 1))).Font.FontStyle = "Fett"
Next j
Next i
End Sub
Sub markierenInSpalteC()
Dim i&, j&, arrM(): arrM = Tabelle2.UsedRange
For i = 4 To Tabelle1.Cells(Rows.Count, 1).End(xlUp).Row
For j = LBound(arrM) To UBound(arrM)
If InStr(1, Tabelle1.Cells(i, 1), arrM(j, 1), vbTextCompare) > 0 Then Tabelle1.Cells(i, 3).Characters(Start:=InStr(1, Tabelle1.Cells(i, 1), arrM(j, 1), vbTextCompare), Length:=Len(arrM(j, 1))).Font.FontStyle = "Fett"
Next j
Next i
End Sub