View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Alan Beban[_2_] Alan Beban[_2_] is offline
external usenet poster
 
Posts: 783
Default Add dimesion to Array already populated

Alan Beban wrote:
. . .
To get Harlan Grove's suggested code

v = Split("a b c d e f g h i j k l m n o p")
v = Application.WorksheetFunction.Transpose(v)
ReDim Preserve v(LBound(v, 1) To UBound(v, 1), 1 To 6)
v = Application.WorksheetFunction.Transpose(v)

to work I had to add ReDim v at the beginning; otherwise I got an
Invalid ReDim error message (in xl2002).


Sorry. Harlan Grove obviously intended the above snippet to follow the
Dim Statement he had provided, i.e.,

Dim v As Variant
ReDim v(0 To 1)
v(0) = Split("a b c d e f g h i j k l m n o p")
v(1) = Array(1, 2, 2, 2, 1, 2, 2, 2, 1, 2, 2, 2, 2, 2, 1, 2)
Debug.Print v(1)(5); v(0)(9)

Alan Beban