Scenario Manager Question


Posted by Hansoh on November 16, 2001 11:34 AM

1st off, what a great resource this site is.

scenario manager has a constraint of 32 changing cells. what if i have 50 or 100 potential changing cells in 1 worksheet...can anybody suggest a creative workaround re: this constraint? feel free to suggest simple macros...anything. thanks in advance.

han soh

Posted by Juan Pablo on November 16, 2001 1:28 PM

You would have to work this a little bit, BUT, i imagine you could do this.

In a separate worksheet put:
from B1 and in row 1, put numbers from 1 to number of scenarios you have. (Let's say 4). That gives {1,2,3,4} in B1:E1

In A1, put "Cell Address"
Now starting in A2 and going DOWN, put the ADDRESS (Like "$C$155", "D140","B32", etc.). Let's say this list goes down till A100.

Finally, in B2:E100 you can put each scenario value for the according cell.

Now, the important one. The macro. Let's say that your "scenario" sheet is called that "Scenario", and this new sheet is "Data". Try with:

Sub ExtendedScenario()
Dim i as Long
Dim sc as Integer
Dim WSD as Worksheet
Dim WSE as Worksheet

Set WSE = Sheets("Scenario")
Set WSD = Sheets("Data")

sc = Application.InputBox("Please enter a scenario number","Enter scenario",Type:=1)

For i = 2 to WSD.Range("A65536").End(xlUp).Row
WSE.Range(WSD.Cells(i,1)) = WSD.Cells(i,sc+1)
Next i

WSE.Select
MsgBox "Done",vbInformation,"Done"

End Sub

That should work.

Juan Pablo



Posted by IML on November 16, 2001 3:18 PM

Also

If your scared to death of VBA like I am, you could also set up the table like Juan suggests. On your data sheet put the scenario name in cell A1 and use the following formula for where ever you want to populate your scenarios.

=VLOOKUP(ADDRESS(ROW(),COLUMN(),4),scenario!$A$1:$E$100,MATCH($A$1,scenario!$B$1:$E$1,0)+1,0)

Disclaimer - I'm scared of VBA because I don't know how to use. This is not anti-vba propoganda.