|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
’用数组填充颜色比字典要快些
Sub 数组填充()
Dim rng As Range
Dim arr As Variant
Dim i As Integer, t
t = Timer
ActiveSheet.[a1].CurrentRegion.Interior.ColorIndex = xlNone
arr = ActiveSheet.[a1].CurrentRegion
For i = 2 To UBound(arr)
If arr(i, 6) > 2000 Then
If rng Is Nothing Then
Set rng = ActiveSheet.Range("a" & i).Resize(1, UBound(arr, 2))
k = 1
Else
Set rng = Union(rng, ActiveSheet.Range("a" & i).Resize(1, UBound(arr, 2)))
k = k + 1
If k > 30 Then
rng.Interior.ColorIndex = 3
k = 0
Set rng = Nothing
End If
End If
End If
Next i
MsgBox Timer - t
End Sub
|
评分
-
1
查看全部评分
-
|