Sub CommandButton1_Click()
. . .
' Set the elements of the covariance matrix
covariance(0) = TextBox1.Value
covariance(1) = TextBox2.Value
. . .
' Set the upper and lower bounds
x_lower(0) = TextBoxBL1.Value
. . .
' Set the asset returns
asset_returns(0) = TextBoxR1.Value
asset_returns(1) = TextBoxR2.Value
asset_returns(2) = TextBoxR3.Value
. . .
' Now compute the optimal portfolio
PORT.CALCULATE n, x(0), x_lower(0), x_upper(0), x_index(0), portfolio_return,
portfolio_risk, asset_returns(0), covariance(0), tol, err
. . .
' Output the optimal portfolio holdings
TextBoxP1.Value = FormatNumber(x(0),4)
TextBoxP2.Value = FormatNumber(x(1),4)
TextBoxP3.Value = FormatNumber(x(2),4)
End Sub
| Previous slide | Next slide | Back to first slide |