I have created an array named "arrRecords" using a query from ODBC. I want to output the value of that array into my worksheet. The array has 4 columns but the number of rows depends on the query. How do i do this?
Please help.
Something like this should work:
Sub printarray(arrRecords)
Dim i As Long, j As Long
For i = 1 To 4
For j = 1 To UBound(arrRecords, 2)
ActiveSheet.Cells(j, i).Value = arrRecords(i, j)
Next j
Next i
End Sub
Activesheet.cells needs to be replaced with whatever loaction you want to input the array.
Note that depending on your set up the dimensions may be switched. With ubound(array,2) one can get the Upperbound of an array second dimension. Then just loop through it. Note also that i and j do not have to start with 1 this is dependend on your case.
Flies away!
resizeandubound