Using Loop to create Array
Another way using VBA similarly to what you are trying
ReDim v(1 To 1)
j = 1
For i = 1 To 100 Step 0.5
ReDim Preserve v(1 To j)
v(j) = "Level" & i
j = j + 1
Next
For j = LBound(v) To UBound(v)
Debug.Print v(j)
Next
--
HTH
Bob Phillips
"Nick Hebb" wrote in message
oups.com...
The problem is, it sees the contents of Left(k, len(k)-1) as one big
string. All those apostrophes are just elements of the string, not
separators.
An easier way to do it is to use the split() function:
For i = 1 To 100 Step 0.5
k = k & "Level " & i & ","
Next
'create the array
v = Split(Left(k, Len(k) - 1), ",")
For j = LBound(v) To UBound(v)
Debug.Print v(j)
Next
Also, I changed the <<k = k & """" & "Level" & """" & i line because
I couldn't quite understand what you were trying to do.
|