Re: newbie: array passing problem
- From: "Larry Serflaten" <serflaten@xxxxxxxxxxxxxx>
- Date: Sat, 14 Jul 2007 12:35:34 -0500
"tom" <tadamsmar@xxxxxxxxx> wrote
Can I pass a one dimension of an array as an array?
While not exceptionally performant (it will be slower)
you might consider an array of arrays:
LFS
Option Explicit
Private Sub Form_Load()
Dim A As Variant, i, j
ReDimEx A, 3, 5, vbVSingle
For i = 0 To 3
For j = 0 To 5
A(i)(j) = i * j
Next j, i
FUBAR A(1)
End Sub
Sub FUBAR(ByVal Ary As Variant)
Dim i
For i = 0 To UBound(Ary)
Debug.Print Ary(i)
Next
End Sub
Sub ReDimEx(ByRef ArrayID As Variant, _
ByVal Row As Long, _
ByVal Col As Long, _
ByVal CellType As VBRUN.VariantTypeConstants)
Dim i As Long, A() As Long, B() As Single
ReDim ArrayID(0 To Row)
Select Case CellType
Case vbLong
For i = 0 To Row
ReDim A(0 To Col) As Long
ArrayID(i) = A
Next
Case vbSingle
For i = 0 To Row
ReDim B(0 To Col) As Single
ArrayID(i) = B
Next
End Select
End Sub
.
- References:
- newbie: array passing problem
- From: tom
- newbie: array passing problem
- Prev by Date: Re: How to insert space charater
- Next by Date: Re: set text file extended property
- Previous by thread: Re: newbie: array passing problem
- Next by thread: Re: newbie: array passing problem
- Index(es):
Relevant Pages
|