Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Goal Seek Excel 2

Status
Not open for further replies.

pat2009

Specifier/Regulator
Jul 24, 2009
2
0
0
GB
thread770-224290

Hello handleman

My question is similar to the thread but it is a very basic question to do with incorporating your goal seek code into Excel in the so it runs automatically each time cells are changed instead of having to run a macro

My example

Goal seek by Setting cell C6 to 5,000 by changing A5

What I need to know is where you insert the VBA code – it does not work when I simply paste your code in the macro editor for an existing recorded macro. So I would be very grateful if you could assume that I am starting from scratch and have no macro at all and outline the steps I need to take as a basic excel user

Thanks
 
Replies continue below

Recommended for you

Here's one I use to iterate thru the Fanning Friction Factor.
This would be in the worksheet VBA & a "selectionchange"

Private Sub Worksheet_Calculate()
If IsNumeric(Range("error")) Then
If Range("error") <> 0 Then
Range("error").GoalSeek Goal:=0.0000000001, ChangingCell:=Range("assum_F")
End If
End If
End Sub
 
Thanks Psafety

Unforunately I do not program in VBA so Could you please outline in a step by step manner what I need to do in Excel/VBA editor/macro to have an automatic goal seak update in an excel worksheet using teh example I gave . Thanks again
 
Private Sub Worksheet_Calculate()
Private Sub Worksheet_Calculate()
If IsNumeric(Range("c6")) Then
If Range("c6") <> 5000 Then
Range("c6").GoalSeek Goal:=5000, ChangingCell:=Range("a5")
End If
End If
End Sub
 
Status
Not open for further replies.
Back
Top