ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Record Set To Sheet (https://www.excelbanter.com/excel-programming/352549-record-set-sheet.html)

Jim Heavey

Record Set To Sheet
 
I am wondering the easy way to take data retrieved from a database, which is
now sitting in a record set, and place that data into the sheet. Do I need
to itterate through the record set and navigate cell by cell of my sheet, or
is there a quicker way to get all the data loaded into a specific area of my
sheet

Thanks in advance for your assistance!!

sebastienm

Record Set To Sheet
 
Hi

Use the CopyFromRecorset method of the Range object.
Say you want to paste your recordset starting in A1:
Dim Rst as adodb.recordset
...
Range("A1").CopyFromRecordset Rst

done!
The syntax is Range.CopyFromRecorset Recordset, MaxRows, MaxColumns
--
Regards,
Sébastien
<http://www.ondemandanalysis.com


"Jim Heavey" wrote:

I am wondering the easy way to take data retrieved from a database, which is
now sitting in a record set, and place that data into the sheet. Do I need
to itterate through the record set and navigate cell by cell of my sheet, or
is there a quicker way to get all the data loaded into a specific area of my
sheet

Thanks in advance for your assistance!!



All times are GMT +1. The time now is 04:34 PM.

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