RE: Deleting blank values from an array
- From: "Greg Wilson" <GregWilson@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 31 May 2005 23:15:26 -0700
It seems that the easiest approach would be to prevent blank values from
getting added to the array in the first place. Failing that, one simple
solution is to transfer non-blank values from the original array to a second
dynamic array. Then use the second array and forget the first. I'm sure
someone has a more elegant solution. I think it would be more efficient to
sort afterwards.
'Where Arr is array containing blanks and Arr2 is dynamic array
ii = 0
For i = LBound(Arr) To UBound(Arr)
If Arr(i) <> "" Then
ReDim Preserve Arr2(ii)
Arr2(ii) = Arr(i)
ii = ii + 1
End If
Next
Regards,
Greg
"Rich J" wrote:
> I have an array that gets populated with dates from various ranges in my
> spread***. In the process blank values also get included. Once filled, I
> would like to sort the array with the earliest date in H(0) and the blank
> ones deleted by redimensioning the array.
> I figured out one way to sort but the blank ones are all in the lower
> indexes with the sorted dates at the end.
> Is there an easy way to delete the empty elements of the array either while
> sorting or another routine after the sort ?
> I used the sorting routines in this help site
>
> http://support.microsoft.com/?kbid=213818
> I tried a filter routine but it created an error
> Thanks
.
- Follow-Ups:
- RE: Deleting blank values from an array
- From: Rich J
- RE: Deleting blank values from an array
- References:
- Deleting blank values from an array
- From: Rich J
- Deleting blank values from an array
- Prev by Date: Re: Program compatability - 2002 vs. 2000
- Next by Date: Capitalize input
- Previous by thread: Re: Deleting blank values from an array
- Next by thread: RE: Deleting blank values from an array
- Index(es):