Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/haskell/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
我希望在VBA内存中进行计算,计算完成后,只将要粘贴到MS EXcel中的行中的值_Excel_Vba - Fatal编程技术网

我希望在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

我希望在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 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!成功了!谢谢!