Option Base 0
Sub Test_Trim1darray()
Dim a() As Variant
a = Array("Ken", "", "Hobson")
MsgBox Join(a, vbLf)
Trim1dArray a()
MsgBox Join(a, vbLf)
a = Array("Ken", "", "Hobson")
MsgBox Join(a, vbLf)
Trim1dArray a(), "Ken"
MsgBox Join(a, vbLf)
End Sub
Sub Trim1dArray(ByRef anArray() As Variant, Optional aVal As Variant = Empty)
Dim a() As Variant, element As Variant, iCount As Long
iCount = -1
ReDim a(UBound(anArray))
For Each element In anArray
If element <> aVal Then
iCount = iCount + 1
a(iCount) = element
End If
Next element
ReDim Preserve a(iCount)
anArray() = a()
End Sub