該宏用於識別任何單元格中的字符串「%」,如果存在,則通過將它着色爲黃色來標識它。類型不匹配,但功能代碼
有趣的是它不實際工作,但我不斷收到類型不匹配錯誤後記專門就行了:
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
任何幫助,將不勝感激!
試圖複製,但...它運行順利,沒有錯誤:/當你得到錯誤? – Davide 2013-05-13 08:49:09
是的,我也按照預期工作。你能給我們一個你運行它的數據的例子嗎? – 2013-05-13 08:54:48
這似乎確實工作,如果我刪除一定量的行下..也許在C列有一些不愉快的運行線:如果InStr(rngCell.Value,「%」)> 0然後 – user1717622 2013-05-13 09:09:13