ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Selection or Recordset to Array (https://www.excelbanter.com/excel-programming/328044-selection-recordset-array.html)

Witek[_2_]

Selection or Recordset to Array
 
Hello:)
I take data with two ways.
1. From acces, sql with select string
2. From Sheet in Excel

Is any idea to put data from "Selection" to Array?
Like this:
varArray()=selection
or
varArray()=newRS ' active recordset
I made now loop:
For or Do While through
- all records in recordset
- all rows in demension (selection), row by row, field by field.


Tx for any advice:)




*** Sent via Developersdex http://www.developersdex.com ***

Patrick Molloy

Selection or Recordset to Array
 
read Help

dim arr as Variant
arr = Selection

DIM rs as Recordset

' populate from database


Range("B2").Resize(rs.RecordCount, rs.Fields.Count).CopyFromRecordset
rs




<Witek wrote in message ...
Hello:)
I take data with two ways.
1. From acces, sql with select string
2. From Sheet in Excel

Is any idea to put data from "Selection" to Array?
Like this:
varArray()=selection
or
varArray()=newRS ' active recordset
I made now loop:
For or Do While through
- all records in recordset
- all rows in demension (selection), row by row, field by field.


Tx for any advice:)




*** Sent via Developersdex http://www.developersdex.com ***





All times are GMT +1. The time now is 08:37 AM.

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