View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dick Kusleika[_4_] Dick Kusleika[_4_] is offline
external usenet poster
 
Posts: 595
Default Creating a recordset over a range

James

You can put the range in an ADO recordset, or so I've heard, but I also hear
that it's very unstable. One thing that you might try is putting the range
in an array and looping through the array instead of the range.

Dim vaRst as Variant

vaRst = Sheet1.Range("A1:D100").Value

Now you will have a variant array with all the values in that range.
vaRst(row,column) will let you access those values in your algorithm without
the slow-down of accesing the spreadsheet.

--
Dick Kusleika
Excel MVP
Daily Dose of Excel
www.dicks-blog.com

James wrote:
All,

Would be grateful for any help on the following...

I need to create a recordset over an excel range and use bits of it
(i.e. SELECT DISTINCT ColOneName FROM rst) as the source for lists on
a user form. Have tried creating the fields and iterating through
each row to create it but it takes too long. Any ideas?

Thanks in advance,

James