Hello –
I am hoping someone can help provide some additional code.
This original code (not mine, and I wish I could find the original author to cite them) allows for an automatic goal seek through a number of scenarios. It works fine as-is.
What I’d like it to do is after each scenario, as it is cycling through and solves for the goal seek is to then copy a value from a difference cell (that was a calculated cell based on the value determined from the goal seek) and then paste it in a particular cell. After each scenario, paste it into the next row. I run thousands of scenarios at one time, so this would be helpful. (Note, I had a way of doing this with Data Tables too, but it is just too resource intensive for my computer to handle efficiently).
Original Code without the change:
Sub blah1()
For Each cll In Range("Y39")
For Each celle In Range("ScenarioRange")
Range("F31").Value = celle.Value
Range("N36").Value = cll.Value
Range("O9").GoalSeek Goal:=Range("P36"), ChangingCell:=Range("F31")
Cells(celle.Row, cll.Column).Value = Range("F31")
Next celle
Next cll
End Sub
Want to add this functionality:
Scenario 1, [copy the value from cell AO39 to AO40
Scenario 2, [copy the value from cell AO39 to AO41
Scenario 2, [copy the value from AO39 to AO42]
Etc
Note: “ScenarioRange” is just a defined name of cells. Like I say, it works fine. =OFFSET('MAIN TOGGLE'!$M$39,1,0,'MAIN TOGGLE'!$M$36)
Any help would be appreciated!
Tks
M
I am hoping someone can help provide some additional code.
This original code (not mine, and I wish I could find the original author to cite them) allows for an automatic goal seek through a number of scenarios. It works fine as-is.
What I’d like it to do is after each scenario, as it is cycling through and solves for the goal seek is to then copy a value from a difference cell (that was a calculated cell based on the value determined from the goal seek) and then paste it in a particular cell. After each scenario, paste it into the next row. I run thousands of scenarios at one time, so this would be helpful. (Note, I had a way of doing this with Data Tables too, but it is just too resource intensive for my computer to handle efficiently).
Original Code without the change:
Sub blah1()
For Each cll In Range("Y39")
For Each celle In Range("ScenarioRange")
Range("F31").Value = celle.Value
Range("N36").Value = cll.Value
Range("O9").GoalSeek Goal:=Range("P36"), ChangingCell:=Range("F31")
Cells(celle.Row, cll.Column).Value = Range("F31")
Next celle
Next cll
End Sub
Want to add this functionality:
Scenario 1, [copy the value from cell AO39 to AO40
Scenario 2, [copy the value from cell AO39 to AO41
Scenario 2, [copy the value from AO39 to AO42]
Etc
Note: “ScenarioRange” is just a defined name of cells. Like I say, it works fine. =OFFSET('MAIN TOGGLE'!$M$39,1,0,'MAIN TOGGLE'!$M$36)
Any help would be appreciated!
Tks
M