ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Select a column from a matrix (https://www.excelbanter.com/excel-programming/412379-select-column-matrix.html)

[email protected]

Select a column from a matrix
 
Hello,

I have declared a variable:
Dim dataHere(1 to 9, 1 to 3) as double

How could I select the second column from this matrix to use in
further calculations ?

I tried dataHere(All, 2) and dataHere(1 To 9 , 2)but got an error each
time.

Any ideas ?

Tom


Gary Keramidas

Select a column from a matrix
 
not exactly sure what you're trying to do, but maybe this will give you an idea.

Sub test2()
Dim x As Long
Dim dataHere As Variant
dataHere = Range("A1:C9")
For x = LBound(dataHere) To UBound(dataHere)
Debug.Print dataHere(x, 2)
Next
End Sub

--


Gary


wrote in message
...
Hello,

I have declared a variable:
Dim dataHere(1 to 9, 1 to 3) as double

How could I select the second column from this matrix to use in
further calculations ?

I tried dataHere(All, 2) and dataHere(1 To 9 , 2)but got an error each
time.

Any ideas ?

Tom




[email protected]

Select a column from a matrix
 
On Jun 11, 4:02*pm, "Gary Keramidas" <GKeramidasATmsn.com wrote:
not exactly sure what you're trying to do, but maybe this will give you an idea.

Sub test2()
Dim x As Long
Dim dataHere As Variant
dataHere = Range("A1:C9")
For x = LBound(dataHere) To UBound(dataHere)
* * * Debug.Print dataHere(x, 2)
Next
End Sub

--

Gary

wrote in message

...



Hello,


I have declared a variable:
Dim dataHere(1 to 9, 1 to 3) as double


How could I select the second column from this matrix to use in
further calculations ?


I tried dataHere(All, 2) and dataHere(1 To 9 , 2)but got an error each
time.


Any ideas ?


Tom- Hide quoted text -


- Show quoted text -


Hi Gary,

I want to use the result in a MMULT function, so want to take out the
second column and go:

MMULT(dataHere(All, 2), anotherArray)

I'm not sure if this can be done.

Tom


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

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