Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Loop an alphabet

Status
Not open for further replies.

ASPVBNerd

Programmer
Nov 23, 2005
83
SE
I would like to catch the next letter of the alphabet, but I dont know how.

For i = 1 to 27
debug.print i + alphabet letter
Next

Would like the result to be like this.
1a
2b
3c
 
debug.print i & chr(i + 96)

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
A simplish way would be to use:
Code:
For i = 1 To 26
   Debug.Print i & Chr(i + 96)
Next
The Chr function used this way converts the the ascii values of the letters (which start at 97 for the lower case, hence the + 96) into the letters.

Hope this helps

HarleyQuinn
---------------------------------
Get the most out of Tek-Tips, read FAQ222-2244 before posting.
 
Too fast for me there George... [smile]

HarleyQuinn
---------------------------------
Get the most out of Tek-Tips, read FAQ222-2244 before posting.
 
But I like the way you think, HarleyQuinn! [wink]

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
[smile]

HarleyQuinn
---------------------------------
Get the most out of Tek-Tips, read FAQ222-2244 before posting.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top