R
Raul
I'm using a routine to retreive data from a SQL Server database and then
output the results to a worksheet. MaterialTbl is a variant array.
The issue is I get a "Number stored as text" error when I use:
Set DestRange = Range(Worksheets(ThisSheet).Cells(3, 3), _
Worksheets(ThisSheet).Cells(UBound(MaterialTbl, 1), _
3 + UBound(MaterialTbl, 2) - 1))
DestRange.Value = MaterialTbl
But I don't get the error if I use:
For i = 0 To UBound(MaterialTbl, 1)
For j = 1 To UBound(MaterialTbl, 2)
Worksheets(ThisSheet).Cells(3+ i, 3 + j - 1).Value = MaterialTbl(i, j)
Next j
Next i
Why would I get an error with the first method and not get an error with the
latter?
Thanks in advance,
Raul
output the results to a worksheet. MaterialTbl is a variant array.
The issue is I get a "Number stored as text" error when I use:
Set DestRange = Range(Worksheets(ThisSheet).Cells(3, 3), _
Worksheets(ThisSheet).Cells(UBound(MaterialTbl, 1), _
3 + UBound(MaterialTbl, 2) - 1))
DestRange.Value = MaterialTbl
But I don't get the error if I use:
For i = 0 To UBound(MaterialTbl, 1)
For j = 1 To UBound(MaterialTbl, 2)
Worksheets(ThisSheet).Cells(3+ i, 3 + j - 1).Value = MaterialTbl(i, j)
Next j
Next i
Why would I get an error with the first method and not get an error with the
latter?
Thanks in advance,
Raul