View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default VBA Array Population with a Single Line of Code

Hi James,

Single dimension

Dim a

a = Array(2,3,5,7)

Multi-dimension

Dim beta

beta = [{7,3;8,4;9,5;10,6;11,7;12,8;13,9;14,10}]

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"James B" wrote in message
...
I'm trying to figure out how to populate an array variable
in VBA without using something similar to the code below:

ReDim a(1 To 4)
a(1) = 2
a(2) = 3
a(3) = 5
a(4) = 7

Can this be done with a single line of code? Also, can I
populate a single section of a multidimensional array with
something like the following?

beta(7,3 to 14)= ..... the values for those points in the
array

Any help is certainly appreciated. I've been doing this
the long way for years, and it is driving me crazy!