Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel vba insert 'recordset' into a range 1

Status
Not open for further replies.

StuckInTheMiddle

Programmer
Joined
Mar 3, 2002
Messages
269
Location
US

I'm using Excel 2000 and VBA with ADO.

I have a ADO recordset that i would like to insert into a range on a specific worksheet.

This worksheet is referenced elsewhere by formulas on another worksheet. I want to paste my recordsets values into my worksheet and have the formulas automatically change to accomodate the changing number of records I may have on each refresh.

I know i can create a new row, and insert my values 1 cell at a time for each record, but this seems extremely slow and tedious.

I would like know if there is some way add/paste my entire 500 rows from my recordset into a range directly and have my formulaes change automatically to accomadate my new number of rows.

Am i just chasing a pipe dream here or is this possible using VBA?

Thanks,

A.

(The more ASP.NET I do, the more Javascript I find myself using)
 
Take a look at the CopyFromRecordset method of the Range object.

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 

Thank you PHV,

That did the trick nicely.

A.

(The more ASP.NET I do, the more Javascript I find myself using)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top