Greetings,
I have a correlation matrix macro that I use to find correlation values for pairs of data. The macro seems to be working fine, but some of the matrix cell values are left blank. The blank sections are associated with specific parameters and hence leave entire columns and rows blank. I am having trouble understanding why this is occurring? ideas?
Below is the matrix code, although I don't think this is the source of error in this case.
Thanks!
I have a correlation matrix macro that I use to find correlation values for pairs of data. The macro seems to be working fine, but some of the matrix cell values are left blank. The blank sections are associated with specific parameters and hence leave entire columns and rows blank. I am having trouble understanding why this is occurring? ideas?
Below is the matrix code, although I don't think this is the source of error in this case.
Code:
Sub CMatrixUpdate()
Dim i As Integer
Dim J As Integer
Dim a As Integer
Dim b As Integer
Dim c As Integer
Dim d As Integer
Dim e As Integer
Dim f As Integer
Dim arg1 As Range
Dim arg2 As Range
c = Workbooks("Matrix.xls").ActiveSheet.Cells(1, Columns.Count).End(xlToLeft).Column
d = Workbooks("Matrix.xls").ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row
For J = 2 To c
For i = 2 To d
a = J + 4
b = i + 4
e = Workbooks("COMM_COMBINED_INDEPENDENTS.xls").ActiveSheet.Cells(Rows.Count, a).End(xlUp).Row
f = Workbooks("COMM_COMBINED_INDEPENDENTS.xls").ActiveSheet.Cells(Rows.Count, b).End(xlUp).Row
With Workbooks("COMM_COMBINED_INDEPENDENTS.xls").ActiveSheet
Set arg1 = .Range(.Cells(7, a), .Cells(e, a))
Set arg2 = .Range(.Cells(7, b), .Cells(f, b))
End With
On Error Resume Next
Workbooks("Matrix.xls").ActiveSheet.Cells(J, i) = WorksheetFunction.Correl(arg1, arg2)
Next i
Next J
End Sub
Thanks!