Thread: Filter Function
View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Dana DeLouis[_5_] Dana DeLouis[_5_] is offline
external usenet poster
 
Posts: 77
Default Filter Function

Just two cents. I have never gotten this function to filter out blank
strings. This mostly occurs when placing a column of data from the
worksheet into an array. I have tried everything imaginable in the past.
Does anyone know if this "feature" to filter out blank strings was added in
Excel 2003?

Sub Wont_Work_in_Xp()
Dim v
v = Array("ABCD", "ADCE", "", "1234", "ECDA")
v = Filter(v, "", False, vbTextCompare)
End Sub

Returns an empty array.


If one does not like the zero based returned array, here is a technique to
turn it back into a 1-based array.

Sub Demo()
Dim v
Dim v_ZeroBased
Dim v_OneBased

v = Array("ABCD", "ADCE", "BCDA", "1234", "ECDA")
v_ZeroBased = Filter(v, "BC", True, vbTextCompare)

With WorksheetFunction
v_OneBased = .Transpose(.Transpose(v_ZeroBased))
End With
End Sub

--
Dana DeLouis
Using Windows XP & Office XP
= = = = = = = = = = = = = = = = =


"David Robinson" wrote in message
...
can someone post an example of the Filter Function in VB.