Hi,
I have a VBA code for Correl function,
The code is
Function CorrMatrix(rng As Range) As Variant
Dim i As Long
Dim j As Long
Dim numCols As Long
numCols = rng.Columns.Count
numRows = rng.Rows.Count
Dim matrix() As Double
ReDim matrix(numCols - 1, numCols - 1)
For i = 1 To numCols
For j = 1 To numCols
matrix(i - 1, j - 1) = Application.WorksheetFunction.Correl(rng.Columns(i), rng.Columns(j))
Next j
Next i
CorrMatrix = matrix
End Function
The problem is this code works for just 59 colomns, I have almost 150 colmns, when I apply this code I get #Value! error.
Any idea how can I solve this ?
Bookmarks