有没有更好的方法,性能明智的,来做到这一点?
Is there better method, performance wise, to do this?
是否有更快的条件格式单元格引用方法?
代码示例:
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
应该稍微快一点:
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
是否有更快的条件格式单元格引用方法?
代码示例:
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
应该稍微快一点:
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