Results 1 to 2 of 2
  1. #1
    2 Star Lounger
    Join Date
    Apr 2001
    Location
    Chapel Hill, North Carolina, USA
    Posts
    138
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Importing scenario parameters into the Scenario Manager

    Is it possible to build a table of parameters for mulitple scenarios and then import them into the Scenario Manager, versus the process of manually entering the parameters into the Manager?

    Thanks!

    Larry

  2. #2
    Gold Lounger Maudibe's Avatar
    Join Date
    Aug 2010
    Location
    Pa, USA
    Posts
    2,637
    Thanks
    115
    Thanked 650 Times in 592 Posts
    Imandel,

    Here is some code that will build scenarios by entering the values into Scenario Manager from a table. Note: The Scenario table has a header which becomes the name of each scenario. The sample data was obtained from this site. Place code in a standard module.

    Change "I=10" to the row of the scenario header
    Change "For J = 3 To 5" to the columns that contain the scenarios

    HTH,
    Maud

    scenarios.png

    Code:
    Sub AddScenarios()
    'DECLARE AND SET VARIABLES
    Dim scen As Scenario
    Dim I As Integer
    I = 10
    '------------------------------
    'CLEAR ALL SCENARIOS
    For Each scen In ActiveSheet.Scenarios
        scen.Delete
    Next
    '------------------------------
    'BUILD SCENARIOS FROM TABLE
    For J = 3 To 5
        ActiveSheet.Scenarios.Add Name:=Cells(I, J).Value, ChangingCells:=Range( _
            "H3,H4,H6"), Values:=Array(Cells(I + 1, J).Value, Cells(I + 2, J).Value, Cells(I + 3, J).Value)
    Next J
    End Sub
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •