Re: Deleting blank values from an array
- From: "Dana DeLouis" <delouis@xxxxxxxxxxxxx>
- Date: Wed, 1 Jun 2005 17:34:44 -0400
> I tried a filter routine but it created an error
If you had trouble with the Filter command on a 1-Dim array, you may not
have set it up correctly.
See if there are any ideas here that may help.
Filter won't work with blanks, so I hope this gets fixed in a future version
of Excel.
Sub Demo()
Dim v As Variant
ReDim v(1 To 10)
Const Flag As String = "xxx"
Dim j As Long
'// Small 1-D array
For j = 1 To 10
v(j) = j
Next j
'// Make two elements blank!
v(3) = vbNullString
v(7) = vbNullString
'// Scan for blanks
For j = 1 To 10
If v(j) = vbNullString Then v(j) = Flag
Next j
v = Filter(v, Flag, False)
End Sub
HTH :>)
--
Dana DeLouis
Win XP & Office 2003
"Rich J" <RichJ@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:7CC33DBB-3105-48D4-A2BB-5627D318D1F8@xxxxxxxxxxxxxxxx
>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: How can I merge Excel data into MS Word
- Next by Date: Re: Regression
- Previous by thread: Re: Deleting blank values from an array
- Next by thread: Re: Deleting blank values from an array
- Index(es):
Loading