ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Error Converting Passed Range into Array in VBA for Excel (https://www.excelbanter.com/excel-programming/308575-re-error-converting-passed-range-into-array-vba-excel.html)

Dave Peterson[_3_]

Error Converting Passed Range into Array in VBA for Excel
 
Your code (not counting the last bits that I don't have) worked ok for me.

Are you sure you're passing the range from the correct worksheet?

Kurt M. Sanger wrote:

For years I've been passing ranges into Excel functions, then converting them
into an array so that I can use them. But today I'm getting an empty array
instead of a full one. If I pass in a 4x4 array my function seems to work.
But when I pass in a 27x10 array I get nada. After the assignment "arrX =
arrayXIn.Value" the debugger shows arrX is the correct size but its empty.
Here's my code. Any suggestions?

Public Function funcExcelGenXXInv(arrayXIn As Range)
Dim arrX As Variant '27 x 10
Dim arrayXPrime As Variant '10 x 27
Dim arrayXpX As Variant '10 x 10
Dim arrayXpXInv As Variant '10 x 10
Dim intNRows, intNCols As Integer

arrX = arrayXIn.Value
'Find size of X array.
intNRows = UBound(arrX, 1)
intNCols = UBound(arrX, 2)

arrayXPrime = funcTranspose(arrX)
arrayXpX = funcMultM(arrayXPrime, arrX)
arrayXpXInv = funcInvMatrix(arrayXpX)
funcExcelGenXXInv = arrayXpXInv
End Function


--

Dave Peterson



All times are GMT +1. The time now is 11:31 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com