Originally posted by John9
Hi,
** That's a dummy question for you, expert
**
I try to declare and work with an array that I don't know the size he will have during my process.
I don't use often Array so my notion about it are very limited.
Someone get a clue to how to proceed?
Thanx
Create a dynamic array !!
VB Code:
Option Explicit
Private Sub Form_Load()
Dim lstrArray() As String
ReDim lstrArray(0)
lstrArray(UBound(lstrArray)) = "A"
ReDim Preserve lstrArray(UBound(lstrArray) + 1)
lstrArray(UBound(lstrArray)) = "B"
ReDim Preserve lstrArray(UBound(lstrArray) + 1)
lstrArray(UBound(lstrArray)) = "C"
Dim i As Integer
For i = LBound(lstrArray) To UBound(lstrArray)
MsgBox lstrArray(i)
Next
End Sub