📅  最后修改于: 2022-03-11 14:51:55.102000             🧑  作者: Mango
Public Sub DeleteElementFromArray(ByRef pArray As Variant, ByVal pIndex As Long)
Dim index As Integer
If pIndex >= LBound(pArray) And pIndex <= UBound(pArray) Then
For index = pIndex + 1 To UBound(pArray)
pArray(index - 1) = pArray(index)
Next
If UBound(pArray) - LBound(pArray) > 0 Then
ReDim Preserve pArray(UBound(pArray) - LBound(pArray) - 1)
Else
ReDim pArray(0)
End If
End If
End Sub