Goalseek and Macros

Eric From Cocoa

New Member
Joined
Mar 1, 2005
Messages
19
I am trying to make an excel program that can automatically solve the AASHTO DESIGN EQUATION FOR FLEXIBLE PAVEMENT. For any civil engineers out their will attest that it is a rather large equation that can really only be directly solved using goal seek.

My plan is to be able to have the spreadsheet automatically calculate the variable I need after I enter five known values into five different cells, D11 through D15, which are all linked to the equation in another cell, G6. The unknown variable that I am solving for is in cell D16. The cell F6 is the cell value I want the equation to be equal to (generally will be 0).

I have already set up a Goalseek Macro to generate the answer and it works perfectly. However, I want the Macro to run Automatically. The Macro is as follows:

Range("G6").Goalseek Goal:=Range("f6").Value, ChangingCell:=Range("d16")

I then attempted to use the function (=IF(D15="","",Go())) In order run another Macro called Go (). This Macro is as follows

Function Go()
Go = "Goalseek"
Goalseek


End Function

The problem is I can't get the macro "Go ()" to run the Macro "Goalseek ()".


If anyone can tell me to how to make the Goalseek Macro run Automatically that would be awesome.

Thanks
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Hi

You will have to use a worksheet change event to make this happen. Select the worksheet tab, right click and take the view code option. Enter the following

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Address = "$D$15" Then Range("G6").GoalSeek Goal:=Range("f6").Value, ChangingCell:=Range("d16")
End Sub

This should activate every time there is a change in D15.

Tony
 
Upvote 0

Forum statistics

Threads
1,221,645
Messages
6,161,040
Members
451,682
Latest member
ogoreo

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