也许有一种更快的单元格引用条件格式化方法吗?
代码示例:
For Each cell In irow
For i = 1 To arr_size
If cell > start(i) - arr1(i) And start(i) > Var1 And cell <= Var2 Then
cell.Interior.ColorIndex = 22
Exit For
End If
Next i
Next cell
答案 0 :(得分:1)
应该稍微快一点:
Dim v, rng As Range
For Each cell In irow
For i = 1 To arr_size
If start(i) > Var1 Then
v = cell.Value
If v > start(i) - arr1(i) Then
If v <= Var2 Then
If rng Is Nothing then
Set rng = cell
Else
Set rng = aplication.union(rng, cell)
End If
Exit For
End If
End If
End If
Next i
Next cell
If Not rng Is Nothing then rng.Interior.ColorIndex = 22