This subroutine, checkresult, clears the specified range, defines a normal distribution in cell A1, defines a forecast in cell A2, runs a simulation and displays a dialog for each of the CB.MacroResultDetail properties. Then, it clears the Crystal Ball data in cells A1 and A2 and stops.
Sub checkresult()
Range("A1:A2").Select
CB.ResetND
CB.ClearDataND
Range("A1:A2").Clear
Range("A1").Select
ActiveCell.Value = 0
CB.DefineAssumND cbDfaNormal, 0, 1
Range("A2").Select
ActiveCell.Value = "=A1"
CB.DefineForeND
CB.Simulation 1000
MsgBox (CB.MacroResultDetail.DialogResult)
MsgBox (CB.MacroResultDetail.ElapsedTimeInMS)
MsgBox (CB.MacroResultDetail.Msg)
MsgBox (CB.MacroResultDetail.MsgDetails)
MsgBox (CB.MacroResultDetail.MsgTitle)
MsgBox (CB.MacroResultDetail.NewValue)
MsgBox (CB.MacroResultDetail.OldValue)
Range("A1:A2").Select
CB.ResetND
CB.ClearDataND
Range("A1:A2").Clear
End Sub