Re: Increment an Array question

From: Tom Ogilvy (twogilvy_at_msn.com)
Date: 02/22/05


Date: Mon, 21 Feb 2005 19:38:06 -0500

didn't I write the original quite a while ago? Such as

http://groups.google.co.uk/groups?hl=en&lr=&threadm=ONgMtvdsCHA.2332%40TK2MSFTNGP12

or is it derived from something I wrote?

Has it not worked for a long time or has it always been problematic?

-- 
Regards,
Tom Ogilvy
"S G Booth" <sgbooth@totalise.co.uk> wrote in message
news:eXIPRuGGFHA.3812@TK2MSFTNGP15.phx.gbl...
> Have seen both your replies and Jim's. Thanks to you both. It is a segment
> in a bigger series of  routines.
> I still cannot see the error(s).
>
> Will try to create a simple set of data, with the relevent
> code routine and post back.
>
> Regards and thanks.
>
> "Tom Ogilvy" <twogilvy@msn.com> wrote in message
> news:uZ7oYlFGFHA.3492@TK2MSFTNGP12.phx.gbl...
> > If can do two things
> >  if the first element is empty, it writes the range value in the first
> > element.
> >
> > otherwise, it increases the upperbound of the array by one and writes it
> > in
> > the new element.
> >
> >
> > I am not sure what role "i" plays, but you increment that and don't use
> > it.
> >
> > If StartRw is not being incremented, then you would write the same value
> > in
> > every element.
> >
> >> > I find that the following code is overwriting varr(1) each time
> >
> > Not unless .Range("B" & StartRw) is empty and you are placing an empty
> > value
> > in varr(1)
> >
> > -- 
> > Regards,
> > Tom Ogilvy
> >
> >
> >
> > "S G Booth" <sgbooth@totalise.co.uk> wrote in message
> > news:eBemS4EGFHA.1932@TK2MSFTNGP14.phx.gbl...
> >> I'm searching up a column looking for a particular value.
> >> When found, I need to add a range offset from that cell
> >> to an array.
> >> I find that the following code is overwriting varr(1) each
> >> time....so the array never builds correctly
> >>     i = i + 1
> >>     If IsEmpty(varr(1)) Then
> >>         Set varr(1) = .Range("B" & StartRw)
> >>     Else
> >>         ReDim Preserve varr(1 To UBound(varr) + 1)
> >>         Set varr(UBound(varr)) = .Range("B" & StartRw)
> >>     End If
> >>
> >> Why is the array not building correctly, please?
> >>
> >> Regards
> >>
> >>
> >
> >
>
>


Relevant Pages