|
老师,您的这段代码怎样修改才能识别公式转换过来的值?
Sub ykcbf() '//2023.7.10
Dim zrr
With Sheet1
.[d6:k36].Font.ColorIndex = 0
For j = 4 To 11
For i = 6 To 36
st = CStr(.Cells(i, 3)): s = CStr(.Cells(i, j))
If j < 6 Then
ReDim zrr(1 To 2)
zrr(1) = Left(st, 1): zrr(2) = Mid(st, 4, 1)
For x = 1 To Len(s)
If Mid(s, x, 1) = zrr(1) Or Mid(s, x, 1) = zrr(2) Then
.Cells(i, j).Characters(Start:=x, Length:=1).Font.ColorIndex = 3
End If
Next
End If
If j > 5 And j < 8 Then
ReDim zrr(1 To 2)
zrr(1) = Mid(st, 2, 1): zrr(2) = Mid(st, 3, 1)
For x = 1 To Len(s)
If Mid(s, x, 1) = zrr(1) Or Mid(s, x, 1) = zrr(2) Then
.Cells(i, j).Characters(Start:=x, Length:=1).Font.ColorIndex = 3
End If
Next
End If
If j > 7 And j < 10 Then
ReDim zrr(1 To 3)
zrr(1) = Left(st, 1): zrr(2) = Mid(st, 2, 1): zrr(3) = Mid(st, 3, 1)
For x = 1 To Len(s)
If Mid(s, x, 1) = zrr(1) Or Mid(s, x, 1) = zrr(2) Or Mid(s, x, 1) = zrr(3) Then
.Cells(i, j).Characters(Start:=x, Length:=1).Font.ColorIndex = 3
End If
Next
End If
If j > 9 And j < 12 Then
ReDim zrr(1 To 3)
zrr(1) = Mid(st, 2, 1): zrr(2) = Mid(st, 3, 1): zrr(3) = Mid(st, 4, 1)
For x = 1 To Len(s)
If Mid(s, x, 1) = zrr(1) Or Mid(s, x, 1) = zrr(2) Or Mid(s, x, 1) = zrr(3) Then
.Cells(i, j).Characters(Start:=x, Length:=1).Font.ColorIndex = 3
End If
Next
End If
Next
Next
End With
End Sub
|
|