Sub highlight(phm as variant)
Dim w As Workbook
Dim sh As Worksheet
Dim x As Integer
Dim rn As Range
Dim k As Long
Dim number() As integer
If phm <> 0 Then
phm = Split(phm, ",")
ReDim number(LBound(phm) To UBound(phm)) As Integer
Set sh = w.Worksheets("sheet1")
sh.Select
Cells.Find("Number Type").Select
Set rn = sh6.UsedRange
k = rn.Rows.Count + rn.Row - 1
On Error Resume Next
For i = 1 To k
For j = LBound(number) To UBound(number)
number(j) = CInt(phm(j))
If Err.number = 0 Then
If ActiveCell.Value = number(j) Or IsEmpty(ActiveCell.Value) Then
Selection.Interior.ColorIndex = xlNone
Else
Selection.Interior.Color = vbGreen
Exit For
End If
End If
Next j
ActiveCell.Offset(1, 0).Select 'moves activecell down one row.
Next i
End If
ActiveWorkbook.Save
End Sub
我想修改上述代碼,使字母在任何單元格中都被忽略。忽略單元格中的字母,只應檢查數字
例如,細胞可能含有「你好9811」,那麼它不應該被highlighted.Checking應該對數字只是做了在細胞
PHM包含這樣的數據:「9811,7849」等。 。
您可以編輯你的榜樣,使其 – 0m3r
的更加清晰重複[忽略字母,同時通過細胞循環(http://stackoverflow.com/questions/30548004/ignore-alphabets-while-looping-through-細胞)。 – Comintern
在發佈問題之前,請在標籤下進行檢查。注意:您似乎有兩個帳戶 - 您可能會收到警告,或者網站管理員將刪除一個帳戶。 – bonCodigo