Click to See Complete Forum and Search --> : Excel automation


Alexander Abramov
November 13th, 1998, 01:24 AM
Hi!


How can I fill a range of cells on Excel worksheet without moving

from cell to cell and inserting the data into each cell?

Besides I can't use Clipboard to perform such an operation


Thanks for any reply.

Alex.

richardj
May 30th, 2001, 12:47 PM
Two methods to try:
The CopyFromRecordset method allows you to copy an entire recordset (DAO only for Excel 97, or, both DAO and ADO for Excel 2000 as I've just discovered with Kostas) into any Range object, thus:

MyRange.CopyFromRecordset myrecordset

Or, if you're not using recordsets, you can fill a 2-dimensional string array with your values, then, just tell Excel to make the appropriate range equal to your array, thus:

MyRange = MyArray()

I know that's very general, but if you need anything more specific or can say what software versions etc you're using, let us know. There's also more info' on referring to Range objects etc in the appropriate Help files if you need it.