I have some VBA code that cycles through scenarios for goal seek. Typically, I need to run hundreds or thousands in one fell swoop. Sometimes, the code works and get's through all 1000 of the scenarios without any problem. Sometimes it hangs after any number of scenarios. I can't definitively tell what is causing it to hang, but I think it has to do if there is a big difference between the previous scenario goal seek answer, and then the next potential answer. Does anyone have any ideas on why it might hang? Or setting to change, etc, so that it doesn't hang? (Note: I also have similar code using Solver, but it is way too slow, but also seems to hangs). Note: for all of the scenarios, there is ONLY one answer and if I do the goal seek for the problem scenario without the macro, it solves as expected.....
Ideas to help Goal Seek not hang. Setting(s)?
Sub GoalSeeker()
For Each cll In Range("M13")
For Each celle In Range("ScenarioRange")
Range("O31").Value = celle.Value
Range("H9").Value = cll.Value
Range("R31").GoalSeek Goal:=Range("L31"), ChangingCell:=Range("O31")
Cells(celle.Row, cll.Column).Value = Range("O31")
Cells(celle.Row, cll.Column + 1).Value = Range("N31")
Cells(celle.Row, cll.Column + 2).Value = Range("O31")
Cells(celle.Row, cll.Column + 3).Value = Range("Q31")
Next celle
Next cll
End Sub
Ideas to help Goal Seek not hang. Setting(s)?
Sub GoalSeeker()
For Each cll In Range("M13")
For Each celle In Range("ScenarioRange")
Range("O31").Value = celle.Value
Range("H9").Value = cll.Value
Range("R31").GoalSeek Goal:=Range("L31"), ChangingCell:=Range("O31")
Cells(celle.Row, cll.Column).Value = Range("O31")
Cells(celle.Row, cll.Column + 1).Value = Range("N31")
Cells(celle.Row, cll.Column + 2).Value = Range("O31")
Cells(celle.Row, cll.Column + 3).Value = Range("Q31")
Next celle
Next cll
End Sub