How to refresh calculation instantaneously in excel

喜夏-厌秋 提交于 2020-01-13 06:36:29

问题


I have a problem in refreshing the cell's calculation.

In other words, I have many columns where i have a formula or macro in each one of them.

But the problem is that i should absolutely activate the option " automatic calculation" in the excel options or i should save then the new results appear.

Now, I would insert something in the macro that can refresh me the results instantaneously.

Thanks


回答1:


You could simply press :

F9 to calculate the whole active workbook

Shift + F9 to calculate the active sheet


Anyway, here are the different options with .Calculate :

Sub Souma()

'Use this to calculate all the open workbooks
Application.Calculate

'Use this to calculate the whole sheet, called "Sheet1"
ThisWorkbook.Worksheets("Sheet1").Calculate


'Use this to calculate the cell A1 on the sheet called "Sheet1"
ThisWorkbook.Worksheets("Sheet1").Range("A1").Calculate
'Use this to calculate the range A1 to D10 on the sheet called "Sheet1"
ThisWorkbook.Worksheets("Sheet1").Range("A1:D10").Calculate
'Use this to calculate the column A on the sheet called "Sheet1"
ThisWorkbook.Worksheets("Sheet1").Columns(1).Calculate
'Use this to calculate the row 1 on the sheet called "Sheet1"
ThisWorkbook.Worksheets("Sheet1").Rows(1).Calculate

End Sub



回答2:


Copy and paste the code below to your VBA project:

Private Sub Workbook_Open()
Application.Calculation = xlCalculationAutomatic
End Sub

This code should automatically run after you open the Excel file, enabling automatic calculation in all opened files.



来源:https://stackoverflow.com/questions/31959317/how-to-refresh-calculation-instantaneously-in-excel

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!