HomeTechniques and TipsVBA Programming with @RISKAdding Outputs from VBA

10.18. Adding Outputs from VBA

Applies to:  @RISK 5.x–7.x

When I wrote VBA macro code for @RISK 4.x, I used the RiskAddOutput( ) function; but I can't find it in the macro interface for the new version. Which function should I use?

There is no longer a dedicated VBA method to designate an @RISK output. Instead, your macro code should insert a RiskOutput( ) function at the beginning of the formula in the worksheet cell, using normal Excel VBA methods such as the Formula member. For example, suppose you have a cell containing this formula:

=NPV(.1,G1:G10)

To make it an output, change the formula to

=RiskOutput( )+NPV(.1,G1:G10)

Optional arguments to the RiskOutput( ) function let you designate a name for the output, or specify multiple outputs as an output range. For details on usage, please see the RiskOutput topic in the @RISK for Excel Help file or in the Reference section of the @RISK for Excel user manual.

Last edited:  2015-08-31

This page was: Helpful | Not Helpful