我希望在VBA内存中进行计算,计算完成后,只将要粘贴到MS EXcel中的行中的值
我希望在VBA内存中进行计算,计算完成后,只将要粘贴到MS Excel中的行中的值 从下面的代码可以看出,计算是在单元格内进行的,而且非常耗时,因为数据非常庞大 这是我的密码我希望在VBA内存中进行计算,计算完成后,只将要粘贴到MS EXcel中的行中的值,excel,vba,Excel,Vba,我希望在VBA内存中进行计算,计算完成后,只将要粘贴到MS Excel中的行中的值 从下面的代码可以看出,计算是在单元格内进行的,而且非常耗时,因为数据非常庞大 这是我的密码 Sub SumIFF() Dim k As Integer Dim l As Integer Dim ws1 As Worksheet Set ws1 = Worksheets("Input") 'whatever you worksheet is k = 2 'this is the first
Sub SumIFF()
Dim k As Integer
Dim l As Integer
Dim ws1 As Worksheet
Set ws1 = Worksheets("Input") 'whatever you worksheet is
k = 2 'this is the first row where your data will output
l = 2 'this is the first row where you want to check for data
Do Until Range("A" & l) = "" 'This will loop until column U is empty, set the column to whatever you want but it cannot have blanks in it, or it will stop looping. Choose a column that is always going to have data in it.
ws1.Range("X" & k).FormulaR1C1 = "=SUMIF(R2C21:RC[-3],RC[-3],R2C22:RC[-2])" 'reference SUMIF formula
k = k + 1 'Advances k and l when there is a matching case
l = l + 1
Loop
End Sub
在执行计算之前设置Application.ScreenUpdate=False,然后使用Application.ScreenUpdate=True–Pieter Geerkens 7月15日22:05在执行计算之前设置Application.ScreenUpdate=False,然后使用Application.ScreenUpdate=TrueHi!成功了!谢谢!