Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 244
Default Syntax for multidimensional array

I want to create a multidimensional array in VBA. My code is:

Dim strDataMatrix(0 To 10, 0 To 2)

Does that mean ....(rows,columns) or ....(columns,rows) ? I know how an
ordinary array works and everthing but what comes first in the
multidimensional array, the number of rows or columns? Any help very much
appreciated!

I have gooled this but with some results that do not seem coherent with
other VBA functions e.g. Offset or common mathematical notation. Therefor I
need to be sure of how it works. Thanks!


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Syntax for multidimensional array

I think most people think rows by columns.

But it doesn't have to be either. Maybe it's heights and weights with nothing
to do with cells on a worksheet.

But if you're picking up the values from a worksheet range, then the first
dimension will be rows and the second columns.

dim strDataMatrix as variant
dim myRng as range

with activesheet
strDataMatrix = .range("a1").resize(11,3).value
end with

You started your array with 0, but this will be the same as:

dim strDataMatrix(1 to 11, 1 to 3) as variant

(when you pick up those values this way, excel will use base 1.)



Arne Hegefors wrote:

I want to create a multidimensional array in VBA. My code is:

Dim strDataMatrix(0 To 10, 0 To 2)

Does that mean ....(rows,columns) or ....(columns,rows) ? I know how an
ordinary array works and everthing but what comes first in the
multidimensional array, the number of rows or columns? Any help very much
appreciated!

I have gooled this but with some results that do not seem coherent with
other VBA functions e.g. Offset or common mathematical notation. Therefor I
need to be sure of how it works. Thanks!


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sort MultiDimensional Array Mushi Excel Programming 1 August 2nd 06 05:34 AM
Referencing multidimensional array Jay Petrulis[_2_] Excel Programming 2 May 27th 05 02:23 AM
Multidimensional Array DavidMoeller Excel Programming 4 August 12th 04 08:12 PM
MAX of Multidimensional Array ZZZ Excel Programming 2 November 15th 03 03:32 PM
Multidimensional Array problem I can't solve ! Please help me out ! David Van Heuverswyn Excel Programming 3 October 6th 03 01:49 PM


All times are GMT +1. The time now is 09:39 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"