|
Sub x()
Dim k, i, r, x, y, arr
Set r = Range(Cells(3, 2), Cells(Range("a1").End(xlDown).Row - 5, Range("a1").End(xlToRight).Column))
arr = r
i = InputBox("请输入大于多少金额", "请输入金额", 1000)
k = WorksheetFunction.CountIf(r, ">" & i)
For x = 1 To UBound(arr, 1)
For y = 1 To UBound(arr, 2)
If arr(x, y) >= i Then
Cells(x + 2, y + 1).Interior.ColorIndex = 3
End If
Next y
Next x
MsgBox "大于" & i & "的单量有" & k
End Sub
循环内 Interior.ColorIndex 失效 不上色 程序直接 另Cells(x + 2, y + 1).Interior.ColorIndex = 3 下加入stop 也是失效的 程序直接跑完
|
|