Goal Seek Macro takes forever to run

onthegreen03

Board Regular
Joined
Jun 30, 2016
Messages
168
Office Version
  1. 365
Platform
  1. 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
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
You could probably start your macro with:

Application.ScreenUpdating = False

and end with:

Application.ScreenUpdating = True
 
Upvote 0
Solution

Forum statistics

Threads
1,224,567
Messages
6,179,569
Members
452,926
Latest member
rows and columns

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top