ich habe in Spalte A mehrere einzelne Namen stehen. In Spalte B habe ich innerhalb einer Zelle mehrere Namen.
Wie kann ich in Spalte B die Namen farbig markieren, die einzeln in Spalte A vorkommen.
Sub Name_faerben()
Dim a
Dim i As Long, ii As Long
Columns(2).Font.ColorIndex = xlAutomatic
For ii = 1 To Cells(Rows.Count, 2).End(xlUp).Row
With Cells(ii, 2)
a = Split(.Value, " ")
For i = LBound(a) To UBound(a)
If Application.CountIf(Columns(1), a(i)) Then
Cells(ii, 2).Characters(InStr(1, Cells(ii, 2), a(i)), Len(a(i))).Font.Color = vbRed
End If
Next
End With
Next
End Sub
Sub Name_faerben()
Dim a
Dim strName As String
Dim i As Long, ii As Long
Columns(2).Font.ColorIndex = xlAutomatic
For ii = 1 To Cells(Rows.Count, 2).End(xlUp).Row
With Cells(ii, 2)
a = Split(.Value, Chr(10))
For i = LBound(a) To UBound(a)
strName = Left(a(i), InStr(1, a(i), ";") - 1)
If Application.CountIf(Columns(1), strName) Then
Cells(ii, 2).Characters(InStr(1, .Value, strName), Len(strName)).Font.Color = vbRed
End If
Next
End With
Next
End Sub
Sub Name_faerben()
Dim a
Dim strName As String
Dim i As Long, ii As Long
Columns(2).Font.ColorIndex = xlAutomatic
For ii = 1 To Cells(Rows.Count, 2).End(xlUp).Row
With Cells(ii, 2)
a = Split(.Value, Chr(10))
For i = LBound(a) To UBound(a)
If InStr(1, a(i), ";") Then
strName = Left(a(i), InStr(1, a(i), ";") - 1)
If Application.CountIf(Columns(1), strName) Then
.Characters(InStr(1, .Value, strName), Len(strName)).Font.Color = vbRed
End If
End If
Next
End With
Next
End Sub