Function VarCov(rng As Range) As Variant
Dim i As Integer
Dim j As Integer
Dim colnum As Integer
Dim matrix() As Double
colnum = rng.Columns.Count
ReDim matrix(colnum - 1, colnum - 1)
For i = 1 To colnum
For j = 1 To colnum
matrix(i - 1, j - 1) = Application.WorksheetFunction.Covar(rng.Columns(i), rng.Columns(j))
Next j
Next i
VarCov = matrix
End Function

I know you posted this a while ago, but you just saved me a LOT of time, thx, you are the man
ReplyDeletei love reading this article so beautiful!!great job!
ReplyDeleteCompany Formation Singapore
Amazing thanks!
ReplyDeletedude you dont explain how to input.
ReplyDeleteCompany formation Singapore is a fast and efficient process, making it one of the top destinations for global entrepreneurs. With a strong legal framework, low taxes, and business-friendly policies, company formation Singapore provides an ideal environment to start and grow a successful business.
ReplyDelete