- Sub 标注不同字符C()
- Dim myrow%, i%, j%, n%, m%, s%
- Dim str$, s1$, s2$, s3$
- Dim strA$, strB$
- On Error Resume Next
- Call 恢复颜色
- ''将区域设置为文本格式
- Columns("A:K").NumberFormatLocal = "@"
- myrow = Range("A65536").End(xlUp).Row
- For i = 2 To myrow
- ''先修改全部字符串的颜色
- Cells(i, 4).Font.Color = vbRed
- Cells(i, 9).Font.Color = vbRed
- strA = Cells(i, 4).Value
- strB = Cells(i, 9).Value
- ''提取最大相同字符串
- s1 = xt(strA, strB)
- abc:
- m = Len(s1)
- n = InStr(1, Cells(i, 4).Value, s1, 1)
- ' n = InStr(1, strA, s1, 1)
- ''.Characters(Start:=1, Length:=1).Font....
- Cells(i, 4).Characters(n, m).Font.ColorIndex = vbBlack '改成黑色
- n = InStr(1, Cells(i, 9).Value, s1, 1)
- ' n = InStr(1, strB, s1, 1)
- Cells(i, 9).Characters(n, m).Font.ColorIndex = vbBlack '改成黑色
- ''去除相同内容后,再提取相同内容
- strA = Replace(strA, s1, "", 1, , 1)
- strB = Replace(strB, s1, "", 1, , 1)
- If StrReverse(strA) <> strB Then
- If Len(strA) >= 2 And Len(strB) >= 2 Then
- ''提取最大相同字符串
- s1 = xt(strA, strB)
- If s1 <> "" Then
- GoTo abc
- End If
- End If
- End If
- m = 0
- n = 0
- Next i
- End Sub
复制代码 |