ich wollte zellen miteinander vergleichen und die unterschiede hervorheben.
Folgendes Beispiel:
A B C
meTTrt mert TT
mert mertt t
mert m04ert 04
also Zeile C soll die Unterschiede immer Anzeigen.
Ist so etwas möglich?
Wenn ja wie?
vielen Dank!
Mert
Private Sub CommandButton1_Click()
Dim str1, str2, z, max, le1, le2, le, pos, txt
For z = 2 To 1000
max = 0
str1 = Cells(z, 4): str2 = Cells(z, 5)
If str1 "" Then
le1 = Len(str1): le2 = Len(str2)
For pos = 1 To le1
For le = 1 To le1 - pos + 1
txt = Mid$(str1, pos, le)
If InStr(str2, txt) > 0 Then
If Len(txt) > max Then
max = Len(txt)
Cells(z, 9) = txt
End If
End If
Next le
Next pos
End If
Next z
End Sub
Private Sub CommandButton1_Click()
Dim str1, str2, z, max, le1, le2, le, pos, txt
For z = 2 To 1000
max = 0
str1 = Cells(z, 4): str2 = Cells(z, 5)
If str1 "" Then
le1 = Len(str1): le2 = Len(str2)
For pos = 1 To le1
For le = 1 To le1 - pos + 1
txt = Mid$(str1, pos, le)
If InStr(str2, txt) > 0 Then
If Len(txt) > max Then
max = Len(txt)
Cells(z, 9) = txt
End If
End If
Next le
Next pos
End If
Next z
End Sub