EXCEL如何比对相似度

2025-04-24 02:08:00
推荐回答(1个)
回答1:

Private Sub CommandButton1_Click()
[A:B].Font.ColorIndex = xlAutomatic
Dim st$, sr$, i%, j%, r%, k%, m%
r = ActiveSheet.[A65536].End(3).Row
For i = 1 To r
    m = Len(Cells(i, 1))
    For k = 1 To m
        If IsError(Application.Find(Mid(Cells(i, 1), k, 1), Cells(i, 2))) = True Then
            Cells(i, 1).Characters(Start:=k, Length:=1).Font.Color = -16776961
        End If
    Next
Next

For i = 1 To r
    m = Len(Cells(i, 2))
    For k = 1 To m
        If IsError(Application.Find(Mid(Cells(i, 2), k, 1), Cells(i, 1))) = True Then
            Cells(i, 2).Characters(Start:=k, Length:=1).Font.Color = -16776961
        End If
    Next
Next
End Sub