Accessing a 'column' in a VB array

D

den1s

In VB, how does one access an entire column or row. Let's say I have a
5x2 array and I would like to access all the data in the 1 column (i.e.

(1,1 2,1 3,1 4,1 5,1).

So given a variable defined as,


tempArray(1 To 2, 1 To 5) As Double


how could I access all the 1's column?


I know in Matlab I could use the command,


tempArray:),1)


not sure the equivalent in Excel.


- Kwaj
 
J

jindon

den1s said:
In VB, how does one access an entire column or row. Let's say I have a
5x2 array and I would like to access all the data in the 1 colum
(i.e.

(1,1 2,1 3,1 4,1 5,1).

So given a variable defined as,


tempArray(1 To 2, 1 To 5) As Double


how could I access all the 1's column?


I know in Matlab I could use the command,


tempArray:),1)


not sure the equivalent in Excel.


- Kwaj
Try something like

Code
-------------------

Dim i As Integer
For i = LBound(tempArray,2) To UBound(tempArray,2)
MsgBox tempArray(2, i)
Next
 
A

Alan Beban

den1s said:
In VB, how does one access an entire column or row. Let's say I have a
5x2 array and I would like to access all the data in the 1 column (i.e.

(1,1 2,1 3,1 4,1 5,1).

So given a variable defined as,


tempArray(1 To 2, 1 To 5) As Double


how could I access all the 1's column?


I know in Matlab I could use the command,


tempArray:),1)


not sure the equivalent in Excel.


- Kwaj
Application.Index(tempArray, 0, 1)

Alan Beban
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top