View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
NickHK NickHK is offline
external usenet poster
 
Posts: 4,391
Default Jagged arrays - Cannot Define with Arr1()() as integer = New integ

As others have pointed out, that is not VB/VBA code.
Something like this maybe:

Private Sub CommandButton1_Click()
Dim arrAll As Variant
Dim i As Long
Dim TempStr As String

Const MAX_ENTRIES As Long = 10

ReDim arrAll(1 To MAX_ENTRIES)

For i = 1 To MAX_ENTRIES
TempStr = Application.WorksheetFunction.Rept("Text,", Rnd() * 50)
arrAll(i) = Split(TempStr, ",")
Next

Dim j As Long

For i = LBound(arrAll) To UBound(arrAll)
For j = LBound(arrAll(i)) To UBound(arrAll(i))
Debug.Print i, j, arrAll(i)(j)
Next 'j
Next 'i

End Sub

NickHK

"J@Y" wrote in message
...
On MS site, it says use the following to define Jagged arrays:
Arr1()() as Double = New Double()() {}
how come it doesn't seem to work in Excel's VB?