Home |
Search |
Today's Posts |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Loop through array of worksheets | Excel Programming | |||
How do I create a For loop within a For loop? | Excel Programming | |||
Help with Loop / Array / Ranges | Excel Programming | |||
Assign Results from If...Then and Loop to an Array (VBA) | Excel Programming | |||
Help -- Loop or Array? How to identify? | Excel Programming |