|
本帖最后由 吴虾咪 于 2024-8-18 16:30 编辑
提取A例标红的文字同时A例有包含B例的词根全部自动标红.rar
(63.56 KB, 下载次数: 7)
这下有老师弄的,词根在Sheet2,A例里面,不知道啥改成到本表B例里面来。
Sub 飘红()
Dim arr, s&, ss&, i&, j&
arr = Sheet2.Range("A1:A" & Sheet2.Cells(Rows.Count, "A").End(xlUp).Row) ' 标红(Sheet2.Range)表格及位置
With Sheet3
For i = .Cells(Rows.Count, 1).End(xlUp).Row To 1 Step -1
For j = 1 To UBound(arr)
s = InStr(1, .Cells(i, 1).Value, arr(j, 1))
ss = InStr(s + Len(arr(j, 1)), .Cells(i, 1).Value, arr(j, 1))
If s > 0 Then
With .Cells(i, 1).Characters(s, Len(arr(j, 1))).Font
.Color = vbRed
.Bold = True
End With
End If
If ss > 0 Then
With .Cells(i, 1).Characters(ss, Len(arr(j, 1))).Font
.Color = vbBlue
.Bold = True
End With
End If
Next
Next
End With
End Sub
|
|