1
Sub SemiV() markets = Val(InputBox("Number of markets:", "Settings", 9)) nr = Val(InputBox("Number of observations:", "Settings", 3873)) For j = 1 To markets k = 0 For i = 2 To nr + 1 If Cells(i, j) < Cells(nr + 3, j) Then Cells(k + 2, j + markets) = Cells(i, j) k = k + 1 End If Next i Cells(nr + 4, j) = WorksheetFunction.Var(Range(Cells(2, j + markets), Cells(k + 2, j + markets))) Next j MsgBox "Ready!", vbInformation, "Settings" End Sub

Semivariance Macros

Embed Size (px)

DESCRIPTION

Semivariance Macros

Citation preview

Sub SemiV()markets = Val(InputBox("Number of markets:", "Settings", 9))nr = Val(InputBox("Number of observations:", "Settings", 3873))For j = 1 To marketsk = 0For i = 2 To nr + 1If Cells(i, j) < Cells(nr + 3, j) ThenCells(k + 2, j + markets) = Cells(i, j)k = k + 1End IfNext iCells(nr + 4, j) = WorksheetFunction.Var(Range(Cells(2, j + markets), Cells(k + 2, j + markets)))Next jMsgBox "Ready!", vbInformation, "Settings"

End Sub