onthegreen03
Board Regular
- Joined
- Jun 30, 2016
- Messages
- 168
- Office Version
- 365
- Platform
- Windows
Hi all, I have a simple Goal Seek macro that takes 2-3 minutes to complete. The calculation is not very complicated and should only take 2-3 seconds, not minutes. Any advice on how to make this run in less time? When I click the macro button I can see Excel churning through multiple calculations; the spreadsheet is quite large, maybe Excel is going through and recalculating all formulas? I've pasted the code below for reference.
VBA Code:
Sub Macro1()
Range("D109").GoalSeek Goal:=Range("TargetValue1L"), ChangingCell:=Range("D167")
If WorksheetFunction.Sum(Range("D176:F179")) = WorksheetFunction.Sum(Range("D109:F112")) Then
MsgBox "Success, TMsx calculated correctly!!"
Else
MsgBox "TMax did not calculate correctly."
End If
End Sub