I need to loop from a to z.
say
for i=a to z
.....
next
How can I do it?
Here is one way to do it directly as you wrote it...
Enum Letters
a = 97: b: c: d: e: f: g: h: i: j: k: l: m
n = 110: o: p: q: r: s: t: u: v: w: x: y: z
End Enum
Sub test()
Dim X As Variant
For X = a To z
Debug.Print Chr(X)
Next
End Sub
Note that the Enum can be one single line long, like this...
Enum Letters
a = 97: b: c: d: e: f: g: h: i: j: k: l: m: n: o: p: q: r: s: t: u: v: w:
x: y: z
End Enum
but I didn't do it because I suspect the line would wrap in most
newsreaders. If it did, and you copied it that way, the first letter on the
wrapped line would be taken as a Line Label by VB; so, I figured it was
better to break it up for clarity during copying... make it into one line
after you place it into your code.
Note... while I used lower case letters in the Enum and in the For-Next
loop, the casing it not significant... upper case letters work exactly the
same as lower case within the code... the output, however, will still be
lower case because the Enum starts its assignment at 97 (the ASCII code for
lower case 'a').
Rick