ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   How to Read Worksheet Data into VBA Array? (https://www.excelbanter.com/excel-discussion-misc-queries/98860-how-read-worksheet-data-into-vba-array.html)

Peter Bernadyne

How to Read Worksheet Data into VBA Array?
 

Does anyone know of an efficient way to read worksheet data in a
specified range into a VBA array?

For instance, imagine I have a congituous matrix of numbers in Sheet1
in cells A1 through G10.

How might I insert Range("A1:G10").Values into a VBA array in one fell
swoop?

Currently I am looping to populate my VBA array (obviously asinine, I
know)...surely there must be a better way?

Any advice would be gratefully received.


--
Peter Bernadyne
------------------------------------------------------------------------
Peter Bernadyne's Profile: http://www.excelforum.com/member.php...fo&userid=7017
View this thread: http://www.excelforum.com/showthread...hreadid=560749


Peter Bernadyne

How to Read Worksheet Data into VBA Array?
 

Sorry, I got it:

Dim myarray as variant

myarray = Range("A1:G10").value


--
Peter Bernadyne
------------------------------------------------------------------------
Peter Bernadyne's Profile: http://www.excelforum.com/member.php...fo&userid=7017
View this thread: http://www.excelforum.com/showthread...hreadid=560749



All times are GMT +1. The time now is 08:17 PM.

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