|
- Option Compare Text
- Sub 按钮1_Click()
- Application.ScreenUpdating = False
- arr = [a1].CurrentRegion
- For j = 6 To UBound(arr)
- For i = Len(arr(j, 2)) To 2 Step -1
- str1 = Left(arr(j, 2), i)
- x = InStr(arr(j, 1), str1)
- If x > 0 Then
- Cells(j, 2).Characters(1, Len(str1)).Font.ColorIndex = 3
- Cells(j, 1).Characters(x, Len(str1)).Font.ColorIndex = 3
- For k = i + 1 To 2 Step -1
- str1 = Right(arr(j, 2), k)
- y = InStr(arr(j, 1), str1)
- If y > x Then
- Cells(j, 2).Characters(Len(arr(j, 2)) - Len(str1) + 1, Len(str1)).Font.ColorIndex = 3
- Cells(j, 1).Characters(y, Len(str1)).Font.ColorIndex = 3
- Exit For
- End If
- Next
- Exit For
- End If
- Next i
- Next j
- Application.ScreenUpdating = True
- End Sub
复制代码 |
|