this is the first time i see a Redim with 2 dimentions
and i trying to understand, so i changed
ReDim lips (1TB WorksheetFunction.Sum (rSrc.Columns (2)), 1 To 2)
by
ReDim lips (1TB WorksheetFunction.Sum (rSrc.Columns (2)), 1 To 1)
and everything works well, please could you explain to me why 2 dimentions?
Hi Isabelle,
I don't mean to butt in here but maybe you'll find the following
helpful...
A worksheet is a 2D array of cells; Dim1 = num rows, dim2=num cols.
This is by default what you get when you 'dump' a range into a Variant,
and so vSrc(1 To RowCount, 1 To ColCount) is the resulting size of the
array.
Row/col indexes start at 1 and so vSrc(1, 1) contains the value of
row1,col1. vSrc(1, 2) contains the value of row1, col2.
Redim vRes(1 To 6, 1 To 2) results a 6 row by 2 col 2D array that can
be 'dumped' back into the worksheet without the need to Transpose. The
Transpose function has limitations that, though well beyond this
scenario, avoiding the need of it is a good idea when the array needs
to go back into a sheet.
Ron's loop returns a 2-col array where the 2nd col is blank. Your Redim
to 1 col has the same effect except the OP wanted no values in col2 and
Ron's use of '1 To 2' for the 2nd dim clears the values in col2 when
the array is assigned back to A1:B6.
HTH
--
Garry
Free uenet access at
http://www.eternal-september.org
Classic VB Users Regroup
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion