In the below code, nX = xMat.Rank
returns the error "Invalid qualifier." Why? I'm using Excel 2010's built-in VBA editor:
Public Function polyReg(ByRef x() As Double, ByRef y() As Double) As Double()
' =============================
Dim nX, nY, i, j As Integer
Dim xMat() As Double
nX = UBound(x)
nY = UBound(y)
ReDim xMat(1 To nX, 1 To order)
' =============================
For i = 1 To order
For j = 1 To nX
xMat(j, i) = 1
Next j
Next i
' =============================
nX = xMat.Rank
' =============================
polyReg = y
' =============================
End Function
I looked at a few related posts that failed to address my concern:
Invalid Qualifier for String.Add in Outlook VBA
https://stackoverflow.com/questions/7889653/invalid-qualifier-error-in-vba
Invalid or Unqualified Reference
I have not found an answer to my question in Excel's VBA documentation.