|
楼主 |
发表于 2023-5-16 12:00
|
显示全部楼层
自己也写了一个,缺点是第一个601颜色不显示:
Sub Character1()
Dim i As Long, s As Long, lngRowA As Long, lngRowB As Long
lngRowA = Worksheets("A").Cells(Rows.Count, "N").End(xlUp).Row
lngRowB = Worksheets("B").Cells(Rows.Count, "C").End(xlUp).Row
For i = 3 To lngRowB
With Worksheets("B").Cells(i, "c")
br = .Value
ar = Split(br, "、")
For s = 0 To UBound(ar)
For j = 2 To lngRowA
If ar(s) = CStr(Worksheets("A").Cells(j, "N").Value) Then
.Characters(InStr(br, ar(s)), Len(ar(s))).Font.Color = Worksheets("A").Cells(j, "N").Font.Color
End If
Next
Next
End With
Next
End Sub
|
|