I have a toggle cell which feeds calculations throughout multiple sheets in my workbook. The goal is, whenever this toggle cell is changed, workbook recalculates and provides an update number.
I have manual calculation turned on.
Below are methods I have tried (note the code is in a sheet)
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Cells(3, 4)) Is Nothing Then
Application.Calculate
End If
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Cells(3, 4)) Is Nothing Then
Application.CalculateFull
End If
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Cells(3, 4)) Is Nothing Then
Application.CalculateFullRebuild
End If
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Cells(3, 4)) Is Nothing Then
range("DI:DI").calculate
'to calculate the specific range which drives the updated numbers
End If
None of these methods work. The only method is to save the workbook and everything calculates.
Any thoughts?
-----------------------------EDIT-----------------------------
Only solution that works so far, force calculate all cells that are drive the final results. Hoping for a more elegant solution. Total run time ~3seconds\
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Cells(3, 4)) Is Nothing Then
Worksheets("Dashboard").Range("af3").Calculate
Worksheets("Base").Range("R1:R50000").Calculate
Worksheets("Control").Range("R1:R50000").Calculate
Worksheets("Base").Range("DI1:DI50000").Calculate
Worksheets("Control").Range("DI1:DI50000").Calculate
Worksheets("Dashboard").Range("W10:W5000").Calculate
Worksheets("Dashboard").Range("L10:L5000").Calculate
Worksheets("Dashboard").Range("Y10:Aa5000").Calculate
Worksheets("Dashboard").Range("B2:B7").Calculate
end if
If
? – GSergApplication.Calculation = xlCalculationAutomatic
? – user8753746Application.CalculationMode
? – Mathieu Guindon