Hola, el error 10 es porque ya dimensionaste antes el array, ej:
Esto tendrías que poner:
Pero tu codigo sigue funcionando mal
.
Asi que lo hice a mano, tal vez lo puedas mejorar o arreglar,
Y muchas gracias por ayudarme en el otro post
, igualmente tuve una nueva duda, si puedes héchale un vistazo.
Esto tendrías que poner:
Código (vb) [Seleccionar]
Dim arr() As Long
ReDim arr(0 To 5)
arr(0) = 12
arr(1) = 13
arr(2) = 14
arr(3) = 15
arr(4) = 16
arr(5) = 17
Pero tu codigo sigue funcionando mal

Asi que lo hice a mano, tal vez lo puedas mejorar o arreglar,
Código (vb) [Seleccionar]
Private Sub Form_Load()
Dim arr() As Long
ReDim arr(0 To 5)
arr(0) = 12
arr(1) = 13
arr(2) = 14
arr(3) = 15
arr(4) = 16
arr(5) = 17
NewRemoveInArrayLong 4, arr
End Sub
Private Function NewRemoveInArrayLong(ByVal Index&, ByRef ThisArray() As Long) As Boolean
Dim tArray() As Long
Dim i As Integer
If Not IsArray(ThisArray) Or Index& = -1 Then
NewRemoveInArrayLong = False
Exit Function
End If
If Index& = UBound(ThisArray) Then
ReDim Preserve ThisArray(LBound(ThisArray) To (UBound(ThisArray) - 1))
NewRemoveInArrayLong = True
Exit Function
Else
ReDim tArray(LBound(ThisArray) To (UBound(ThisArray) - 1))
For i = LBound(ThisArray) To UBound(ThisArray)
If i < Index& Then
tArray(i) = ThisArray(i)
ElseIf i > Index& Then
tArray(i - 1) = ThisArray(i)
End If
Next i
ReDim ThisArray(LBound(tArray) To UBound(tArray))
ThisArray = tArray
Erase tArray
NewRemoveInArrayLong = True
Exit Function
End If
NewRemoveInArrayLong = False
End Function
Y muchas gracias por ayudarme en el otro post

