此宏旨在识别任何单元格中的字符串“%”,如果存在,则通过将其着色为黄色来识别它。
有趣的是,它确实有效,但我不断收到类型不匹配错误的后记,特别是在该行:
If InStr(rngCell.Value, "%") > 0 Then
这是我下面的完整代码:
Public Sub Markerrorvalues()
Dim iWarnColor As Integer
Dim rng As Range
Dim rngCell As Variant
Dim LR As Long
Dim vVal
Dim tRow
LR = Cells(Rows.Count, "B").End(xlUp).Row
Set rng = Range("C1:C" & LR)
iWarnColor = xlThemeColorAccent2
For Each rngCell In rng.Cells
tRow = rngCell.Row
If InStr(rngCell.Value, "%") > 0 Then
rngCell.Interior.ColorIndex = iWarnColor
Else
rngCell.Interior.Pattern = xlNone
End If
Next
End Sub
任何帮助,将不胜感激!