|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
代码如下。。。
Sub test1()
arr = [a1].CurrentRegion
[a1].CurrentRegion.Font.Color = 0
For i = 2 To UBound(arr)
brr = Split(arr(i, 1), ",")
crr = Split(arr(i, 2), ",")
For j = 0 To UBound(brr)
If InStr(arr(i, 2), brr(j)) = 0 Then Cells(i, 1).Characters(InStr(arr(i, 1), brr(j)), Len(brr(j))).Font.Color = vbRed
Next
For j = 0 To UBound(crr)
If InStr(arr(i, 1), crr(j)) = 0 Then Cells(i, 2).Characters(InStr(arr(i, 2), crr(j)), Len(crr(j))).Font.Color = vbRed
Next
Next
Beep
End Sub
|
|