Answers for "delete element arry vba"

VBA
1

vba delete array element

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
Posted by: Guest on February-15-2021

Code answers related to "VBA"

Browse Popular Code Answers by Language