VBA code to automate goal seek

Bkisley

Board Regular
Joined
Jan 5, 2017
Messages
58
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
 

jscranton

Well-known Member
Joined
May 30, 2011
Messages
707
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)
 

Bkisley

Board Regular
Joined
Jan 5, 2017
Messages
58
Hello, that does not work unfortunately....This does in fact need to be a goal seek or a solver function.
 

Bkisley

Board Regular
Joined
Jan 5, 2017
Messages
58
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?
 

Forum statistics

Threads
1,081,994
Messages
5,362,607
Members
400,684
Latest member
Vie

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top