Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel vba - passing a 3-dimensional array to a subroutine
Hello,
I'm having trouble getting the syntax right for passing a 3-dimensional array to a subroutine. The array in question in originally defined as dim variable() as single Later... ReDim variable(x,y,z) (through a series of For statements) and later still.... Subroutine is called (subroutine needs a specific component of array) A function would work for me as well. Hope someone can help... joran6 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel vba - passing a 3-dimensional array to a subroutine
Hi joran6,
Try dimming the variable as "Dim Variable" instead and leave it as a Variant type. -- Regards, Zack Barresse, aka firefytr To email, remove NOSPAM wrote in message oups.com... Hello, I'm having trouble getting the syntax right for passing a 3-dimensional array to a subroutine. The array in question in originally defined as dim variable() as single Later... ReDim variable(x,y,z) (through a series of For statements) and later still.... Subroutine is called (subroutine needs a specific component of array) A function would work for me as well. Hope someone can help... joran6 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel vba - passing a 3-dimensional array to a subroutine
as shown, the variable is defined as
dim variable as single |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel vba - passing a 3-dimensional array to a subroutine
Did you try the Variant like I showed? You could also try posting all of
your code. -- Regards, Zack Barresse, aka firefytr To email, remove NOSPAM wrote in message oups.com... as shown, the variable is defined as dim variable as single |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel vba - passing a 3-dimensional array to a subroutine
Sub Main()
Dim variable() As Single x = 10 y = 3 z = 3 ReDim variable(1 To x, 1 To y, 1 To z) For i = 1 To x For j = 1 To y For k = 1 To z variable(i, j, k) = i * j * k * Rnd() Next k, j, i Dummy variable End Sub Sub Dummy(v() As Single) MsgBox v(UBound(v, 1), UBound(v, 2), _ UBound(v, 3)) End Sub works fine for me as an illustration. What do you mean by needs a component? -- Regards, Tom Ogilvy " wrote: as shown, the variable is defined as dim variable as single |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel vba - passing a 3-dimensional array to a subroutine
Thanks, Tom!
You've shown me everything I needed. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Re : Excel Sorting a 2-Dimensional Array | Excel Programming | |||
Re : Excel Formulation of 2-Dimensional Array | Excel Programming | |||
Excel Array Conversion from 2-Dimensional to One | Excel Programming | |||
Create One-Dimensional Array from Two-Dimensional Array | Excel Programming | |||
Passing arrays to a subroutine | Excel Programming |