VBA code to automate goal seek

Bkisley

Board Regular
Joined
Jan 5, 2017
Messages
100
I need a goal seek to run every single time the value in cell F1 does not equal zero. When this cell equals zero, that means my numbers tie, if it does not then I need to create a "plug value" to make that value in F1 equal zero. The cell that needs to change is cell D21.

When doing a manual goal seek here is the set up
Set Cell: F1
To value: 0
By changing cell: D21

An alternative solution would be to automatically adjust cell D21 on a tab called Financial every time cell D42 on that same tab does not equal cell K52 on a separate tab named ROCE so that D42 on the financial tab = K52 on the ROCE tab. Cell D21 is the plug in the equation to get a value in D42.

Please please please help me stop this headache of mine!
Thank you very much in advance
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Doesn't sound like a vba project. This formula in D21 will give you the value in d21 if F1 is zero or the value needed to make f21 0.

=IF(F1=0,D21,F1*-1)
 
Upvote 0
Hello, that does not work unfortunately....This does in fact need to be a goal seek or a solver function.
 
Upvote 0
I am not seeing where/how my cells would fit into that code...Sorry, now I'm confused. If you understand this, could you just transpose the cells I need into the code?
 
Upvote 0

Forum statistics

Threads
1,214,814
Messages
6,121,711
Members
449,049
Latest member
THMarana

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