Elizabeth,
This will take the value in the named range "scenario1" and set up a new scenario. You will have to change what cell it is changing and the values that go into the changing cell. Hope this helps!
Ryan
ActiveSheet.Scenarios.Add Name:=Range("scenario1").Value, ChangingCells:=Range("A1"), _
Values:=Array("1234"), Locked:=True, Hidden:=False
Thanks Ryan,
That worked great for getting the name in.
The way that I have this set up, I bring the information in from another sheet into the cell that affect the scenario. This way, the cells are already at their new values before I add the scenario. How do I get my macro to accept the existing cell values as the array values?
Thanks!!!
Elizabeth,
I don't get it! ;-) I would have to see the macro to see what is going on. If you want to post it on here or email it to me I would be able to see what's happening.
Ryan
ufexcel@hotmail.com
Ryan,
Thanks so much for your help!
Here is what I have so far. Hope it helps.
E.
copy info from spreadsheet1 to spreadsheet2 into the range affected in the scenario
Sheets("spreadsheet1).Select
Range("scenarioinfo1").Select
Selection.Copy
Sheets("spreadsheet2").Select
Range("scenarioinfo1").Select
ActiveSheet.Paste
copy title of info (which is also the name of the new scenario) from spreadsheet1 to spreadsheet2 into a cell affected in the scenario
Sheets("spreadsheet1).Select
Range("newscenarioname").Select
Selection.Copy
Sheets("spreadsheet2").Select
Range("scenarioname").Select
ActiveSheet.Scenarios.Add Name:=Range("scenarioname").Value,
ChangingCells:=Range("A1:G10"),_Values:=Array("??????"), Locked:=True,
Hidden:=False
note Range(A1:G10) is the same as scenarioinfo1
ActiveSheet.Scenarios.Show (?????)
Here are my two issues:
1. How do I get the macro to recognize that the values for the array are the ones that are currently in the cells (scenarioinfo1)?
2. How do I get the macro to recognize that the scenario it is to show is the one currently in the cell (scenarioname)?