CB.EnumCorrelation Example 1

This example uses asm1Address to represent Assum1, uses asm2Address to represent Assum2, uses corrValue to represent Value, and then uses a loop to stop execution when all correlated assumptions have been located. As it runs, it displays a message box with the first and second assumption in each pair of correlated assumptions along with the correlation value.

Sub EnumCorr()
   Dim asm1Address As String
   Dim asm2Address As String
   Dim corrValue As Variant
   Dim count As Variant

   CB.CheckData
   ' When asm1Address, asm2Address, and corrValue are passed ByRef, 
   ' the value passed into the function is ignored and the next set of 
   'values in the enumeration is set in these parameters when the call   'returns.

   count = CB.EnumCorrelation(asm1Address, asm2Address, corrValue)

   While (count > 0)
      MsgBox "Assumption in cell " & asm1Address & _ 
         " is correlated to assumption in cell " & asm2Address & _ 
         " by " & corrValue
      count = CB.EnumCorrelation(asm1Address, asm2Address, corrValue) 
   Wend
End Sub