阅读背景:

数列中的字符串会出错。

来源:互联网 
Sub highlight()
   Dim w As Workbook
   Dim sh As Worksheet
   Dim x As Integer
   Dim rn As Range
   Dim k As Long
   Dim number As Variant

   number = Array(9811, 7849)


   Set w = ThisWorkbook


   Set sh = w.Worksheets("Sheet1")
   sh.Select
   Cells.Find("hello").Select
   ActiveCell.Offset(1, 0).Select
   Set rn = sh.UsedRange
   k = rn.Rows.Count + rn.Row - 1
   For x = 1 To k
      For j = 0 To UBound(number)
         If ActiveCell.Value <> number(j) Then
            Selection.Interior.Color = vbYellow
         Else
            Selection.Interior.ColorIndex = xlNone
            Exit For
         End If

      Next j
      ActiveCell.Offset(1, 0).Select 'moves activecell down one row.
   Next x

End Sub
Sub highlight()
   Dim w As Workbook
   Dim sh 



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: