[Help] Advanced Goal Seek in VBA

SaintTrigger

New Member
Joined
Jun 5, 2011
Messages
1
I have a pretty complicated spreadsheet that makes use of a whole bunch of different macros I have written. Right now, I solve my spreadsheet using a simple bisection function that I wrote. However, this takes much longer than I would like it to. Thus, I would like to try to take advantage of Excel's Goal Seek. However, the reason I did not use it in the first place is because once the cell in question is changed, a macro must be run in order to determine the outcome of the variable change.

So, goal seek works like (set "x" = "y" by changing "z").

In my case, "x" is the difference between my spreadsheet value and the value I am looking for. I want this to be close to 0 ("y"). As stated before, the problem is that, once "z" is changed, I need to run a macro to actually determine "x".

So I am wondering if there is a way to call a macro from within goalseek. And if not, does anyone know if I can access the goal seek macro and insert a call function in it (and name it something else, of course).
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
If given a "z", your macro produces an "x", then it can be cast as a UDF.

Putting that formula in a cell will give GoalSeek something to work on.

If your UDF is continuous, there's a good chance that GoalSeek will find a solution.
 
Upvote 0
It would seem that the more straightforward way would be to use a function (also called a User Defined Function, or UDF) to compute x as a function of z.

Essentially, in the cell with the x value, you should have something like =MyFunction({cell with the z value}, {other cells if relevant})
 
Upvote 0

Forum statistics

Threads
1,224,595
Messages
6,179,798
Members
452,943
Latest member
Newbie4296

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