0

I currently have a excel file with a couple of columns and many rows, each cell holds information. Currently my macro has a loop within a loop to go through each row and column. The loop for the row is no problem, i just keep increasing the number by a step of 1, but when it comes to the columns i have made my own sub routine. this subroutines changes the numbers in the loop to letter and stores that letter in a variable.

For firstloop = 3 To number

        For column = 1 To 3
            columnconvert
           'some code in here
         next
next

and this code is the new subroutine i made:

Sub columnconvert()

    Select Case column

        Case "1"
            columnletter = "Q"
        Case "2"
            columnletter = "R"
        Case "3"
            columnletter = "S"
    End Select

    End Sub

i was wondering, is there an easier way to "CONVERT" the loop number to a letter? could i loop through with letters instead of numbers?

HumanlyRespectable
  • 183
  • 5
  • 12
  • 25
  • 3
    look into this answer: [VBA function to convert column number to letter?](http://stackoverflow.com/questions/12796973/vba-function-to-convert-column-number-to-letter). Btw, you can use `Cells(rowNumber,columNumber)` instead `Range("A" & rowNumber)` without any conversion – Dmitry Pavliv Apr 15 '14 at 15:27
  • 1
    Anothwr one :) http://stackoverflow.com/questions/10106465/excel-column-number-from-column-name/10107264#10107264 – Siddharth Rout Apr 15 '14 at 15:41

0 Answers0