Results 1 to 6 of 6

Step through the alphabet with ForNext loop

Threaded View

  1. #1
    Valued Forum Contributor jwright650's Avatar
    Join Date
    12-10-2010
    Location
    Va, USA
    MS-Off Ver
    Excel 2003, Excel 2010
    Posts
    606

    Step through the alphabet with ForNext loop

    How do you go about looping through the alphabet Using a For/Next loop?....I can step through using numbers, but can't seem to declare the correct variables and steps to do the alphabet...
    Tried this...but it's wrong. What I was trying to do was get 1A, 2A, 3A through 5A.....down column A



     
    Sub NestedForLoops()
        Dim r      As Long
        Dim alpha      As String
        alpha = "A"
        For r = 1 To 5 Step 1
            For alpha = "A" To "E" Step 1
                Cells(r, 1).Select
                Cells(r, 1).Value = CStr(r) & CStr(alpha)
            Next alpha
        Next r
    End Sub
    Last edited by jwright650; 04-11-2011 at 01:47 PM.
    Life is like a roll of toilet paper. The closer it gets to the end, the faster it goes.
    John Wright

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1