I'm using Excel 2010. I know how to put recordset into a range. I would need to put recordset into an array. This is the code I use to put it into a range:
And it works, returns 14 results (14 rows, 1 column). The difference should be on the last line, but how?
gives subscript out of range, so does
What's wrong? Do I need some to alter something else than that last row (where I copy it from the recordset to a range)?
Set rsData = New ADODB.Recordset rsData.Open strSQL, strConnect, adOpenForwardOnly, adLockReadOnly, adCmdText If Not rsData.EOF Then Range("A1").CopyFromRecordset rsData Else MsgBox "No records returned.", vbCritical End If
vSRA = rsData.GetRows(14) 'vSRA is a variant Range("A1") = vSRA(1, 1)
vSRA = rsData.GetRows Range("A1") = vSRA(1)