LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 59
Default Scenario Manager question

I am trying to write some code to automate the addition, change and deletion
of scenarios with Scenario Manager to avoid having to open the window and do
everything manually. I basically have an input matrix, and then the code is
supposed to either add, change or delete the scenarios. However, I am getting
a run-time error (unable to get the scenario propery of worksheet class) on
the delete section. I am a relative beginner and any help will be greatly
appreciated:

Set m = Range("f5")
Set M_1 = Range("M_1")
Set M_2 = Range("M_2")

If m.Value = "Add" Then
ActiveSheet.Scenarios.Add Name:=Array(M_1.Value),
ChangingCells:=Range("AnnMil"), _
Values:=Array(M_1.Value)
ActiveSheet.Scenarios.Add Name:=Array(M_2.Value),
ChangingCells:=Range("AnnMil"), _
Values:=Array(M_2.Value)

ElseIf m.Value = "Change" Then
ActiveSheet.Scenarios("M_1").ChangeScenario , Values:=Array(M_1.Value)
ActiveSheet.Scenarios("M_2").ChangeScenario , Values:=Array(M_2.Value)

€˜to delete a scenario
Else
ActiveSheet.Scenarios(Array(M_1.Value)).delete
ActiveSheet.Scenarios(Array(M_2.Value)).delete

End If



 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Scenario Manager Max Excel Discussion (Misc queries) 2 February 19th 07 11:45 AM
Scenario Manager Antonia M. Lafferty Excel Discussion (Misc queries) 4 August 24th 06 07:02 PM
scenario manager cinvic Excel Discussion (Misc queries) 1 July 21st 06 06:14 PM
Scenario Manager Tony0z New Users to Excel 1 April 12th 06 02:34 AM
scenario manager programming question daizy Excel Programming 0 August 30th 05 04:58 AM


All times are GMT +1. The time now is 05:34 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"