Arrays in Excel VBA
Jim Thomlinson wrote:
In the help menu look up the Redim statement Here is one that I was just
working on:
Public Sub LoadRepName()
Dim intCounter As Integer
Dim aryRepName() as String
intCounter = 0
Do While RepName < Empty
ReDim Preserve aryRepName(intCounter)
aryRepName(intCounter) = RepName
'go to next rep anem
intCounter = intCounter + 1
Loop
End Sub
It is generally much better to loop first, then ReDim Preserve once at
the end rather than have a ReDim Preserve call with every iteration of
the loop.
Alan Beban
|