Hi people,
I have a spreadsheet with M-1 rows and N colomns. I want to calcolate the covariance matrix of the spreadsheet and i would like like output an other spreadsheet. I tried to do my self, but no so much result. here my code, but there is a listake
Sub cov()
Dim LR As Long, i As Long, j As Long, LC As Integer
Dim ws1 As Worksheet, ws2 As Worksheet
Application.ScreenUpdating = False
Set ws1 = Sheets("DIFF")
Set ws2 = Worksheets.Add
With ws1
LR = .Cells(Rows.Count, 1).End(xlUp).Row
LC = .Cells(1, Columns.Count).End(xlToLeft).Column
For i = 1 To LR - 1
ws2.Cells(i, i) = Application.Covar(Cells(i, i), Cells(i, i))
For j = i + 1 To LC
covval = Application.Covar(Cells(i, i).Value, Cells(i, j).Value)
ws2.Cells(i, j) = covval
ws2.Cells(j, i) = covval

Next j
Next i
End With
Application.ScreenUpdating = True
End Sub

Please help me. The mistake has to be in this line ws2.Cells(i, i) = Application.Covar(Cells(i, i), Cells(i, i))
can I use excel function for generic cells?
Also I have to diagonilize the matrix and to find the autovalue...so much work head till tomorrow
Also I find some problem in interface cells and spreadsheet. Somebody know some good tutorial?
cheers
Alice

Alice