Download docx - Semivariance Macros

Transcript

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