Home → Techniques and Tips → Evolver and RISKOptimizer → Clearing RISKOptimizer Settings without Clearing @RISK Settings
Applies to: RISKOptimizer in @RISK 6.x/7.x Industrial Edition
How can I clear the model definition and other RISKOptimizer settings?
The easy way is Utilities » Clear @RISK Data. The Settings check box will remove the RISKOptimizer information.
However, it will also remove all the @RISK simulation settings. If you don't want to do this, you can create and run a Visual Basic macro to delete just the RISKOptimizer model, without affecting @RISK's simulation settings.
Press Alt-F11 to open the Visual Basic Editor, then F7 to open the code window.
Paste this code into the window:
Sub ClearOptimizerModel( ) RISKOptimizer.ModelWorkbook.AdjustableCellGroups.RemoveAll RISKOptimizer.ModelWorkbook.Constraints.RemoveAll RISKOptimizer.ModelWorkbook.OptimizationSettings.Engine.OptimizationEngine = OptEngineAutomatic RISKOptimizer.ModelWorkbook.OptimizationSettings.Runtime.TrialCountStoppingCondition = False RISKOptimizer.ModelWorkbook.OptimizationSettings.Runtime.ProgressStoppingCondition = False RISKOptimizer.ModelWorkbook.OptimizationSettings.Runtime.TimeSpanStoppingCondition = False RISKOptimizer.ModelWorkbook.OptimizationSettings.Runtime.StopOnErrors = False RISKOptimizer.ModelWorkbook.OptimizationSettings.Runtime.FormulaStoppingCondition = False End Sub
Please see Setting References in Visual Basic for the appropriate references and how to set them.
Click somewhere in the middle of the ClearOptimizerModel routine, and press F5 to run the code. This will remove the RISKOptimizer model without affecting the @RISK simulation settings.
If you leave the code in place, Excel 2007 or above will no longer store the workbook as an .XLSX but instead will use .XLSM format. This may present you or anyone who opens your workbook with a macro security prompt. To prevent that, you can delete the pasted code before you save the workbook. The RISKOptimizer model will not return when you delete the code.
Last edited: 2015-07-23