ArrayResize




Public Sub AResize(ByRef arrArray As Variant, _
ByVal intSize As Integer, Optional _
ByVal boolClear As Boolean)
' Resize the array to a new given size

If boolClear Then
' Clear all existing items

ReDim arrArray(intSize)
Else
' Preserve all existing items

ReDim Preserve arrArray(intSize)
End If
End Sub


Inputs:
arrArray As Variant
The array To resize
intSize As Integer
The number of empty items/"storage index" to:
add If positive; or remove if negative
boolClear As Boolean
Indicate To preserve or clear contents when resizing the array

Assumes:
Care must be practived to avoid loss of data when
adding items. The function preserves existing items
by default To ensure resizing the array correctly
use the syntax: AResize(arrName, UBound(arrName) + intUpDown)
Where intUpDown may be either a positive or a negative integer.











( arrayresize.html )- by Paolo Puglisi - Modifica del 17/12/2023