View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Alan Beban[_2_] Alan Beban[_2_] is offline
external usenet poster
 
Posts: 783
Default Deleting data and element in a 1D array

With the 20's replaced by 600000, the size of the OP's array, it took 39
seconds to run on my machine. I know I don't always bow to efficiency,
but that's a lot even for me :-)

Alan Beban

Dana DeLouis wrote:

If one is willing to work with strings, than it might be possible.
There is still a "feature" missing in that it will not work with blank/null
strings. That is why you have to replace values with something unique
instead of a blank string "".

Sub Demo()
'// Dana DeLouis
Dim x As Long
Dim v As Variant
Const Unique = "ÿ" ' Alt + 0255
ReDim v(1 To 20)

For x = 1 To 20
v(x) = CStr(x)
Next x

'Delete every third
For x = 3 To 20 Step 3
v(x) = Unique
Next x
v = Filter(v, Unique, False)
End Sub