|
Private Sub 库存需求分析2()
Dim Lastrow As Integer, i As Integer, x As Integer, Data()
Application.ScreenUpdating = False
Rows.Interior.ColorIndex = xlColorIndexNone
Lastrow = Cells(Rows.Count, 2).End(xlUp).Row
Data = Range("a2:f" & Lastrow)
x = 1
For i = 2 To UBound(Data)
Cells(i + 1, 6) = Data(i, 5) - Data(i, 4)
If Data(i, 4) > Data(i, 5) Then Range(Cells(i + 1, 1), Cells(i + 1, 6)).Interior.ColorIndex = 36
Next
Application.ScreenUpdating = True
End Sub
程序虽用到数组加快了速度,但红字部分还是分多次用到改变单元格对象的操作,就影响了速度。我想把所有需要改变颜色的单元格先装进变量,以求一次性地改,希望多节省时间。
商品库存需求分析表(chb).rar
(10.16 KB, 下载次数: 0)
|
|