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

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
You could probably start your macro with:

Application.ScreenUpdating = False

and end with:

Application.ScreenUpdating = True
 
Upvote 0
Solution

Forum statistics

Threads
1,223,715
Messages
6,174,065
Members
452,542
Latest member
Bricklin

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