|
Remove element from array by content
'removes only the first instance of the array that matches the value
'if you know the upper/lower limits of the array, just use them
'TestValue and MyArray should have the same Type
Dim
i
As
Long
, j
As
Long
For
i
=
Lbound
(MyArray)
To
Ubound
(MyArray)
-
1
If
MyArray(i)
=
TestValue
Then
For
j
=
i
To
Ubound
(MyArray)
-
1
MyArray(j)
=
MyArray(j
+
1)
Next
j
Exit
For
End If
Next
i
|