excel中如何即时刷新计算结果

Sou*_*uma 6 excel vba excel-formula

我在刷新单元格的计算时遇到问题。

换句话说,我有很多列,每一列都有一个公式或宏。

但问题是我绝对应该激活Excel选项中的“自动计算”选项,否则我应该保存然后出现新结果。

现在,我会在宏中插入一些可以立即刷新结果的内容。

谢谢

小智 8

要强制更新所有公式(包括自定义 VBA 公式),请在 VBA 中执行以下命令:

Application.CalculateFullRebuild
Run Code Online (Sandbox Code Playgroud)

这也可以从 VBA 立即窗口执行。

更多文档在这里: https ://learn.microsoft.com/en-us/office/vba/api/excel.application.calculatefullrebuild


R3u*_*3uK 3

您只需按:

F9计算整个活动工作簿

Shift + F9计算活动工作表


无论如何,这里有不同的选项.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
Run Code Online (Sandbox Code Playgroud)