Excel VBA

css navigation by Css3Menu.com

List of Column Numbers

I think this one comes more under the category or is it practical or just prove to myself I could do it.

You tell it how many columns you want and it tells you what column number and letters it is.

Sub MakeExcelColNumbs()
    Dim LastCol     As LongPtr
    Dim Head1       As String
    Dim Head2       As String
    Dim Z           As Long  'row
    Dim TheNumb     As Integer
    Dim CurCol      As LongPtr
    Dim Skipper     As Integer
    Skipper = 65
    LastCol = InputBox("How many letters wide do you want?" & vbCrLf & "Enter a EVEN number", "IZ is good", 20)
    Head1 = "Col Ltr"
    Head2 = "Number"
    TheNumb = 1
    ActiveWorkbook.Sheets.Add
    For CurCol = 2 To LastCol Step 2
            If CurCol - 1 <= 3 Then
                Skipper = Skipper
            Else
                Skipper = Skipper + 1
            End If
        Cells(1, CurCol - 1) = Head1
        Cells(1, CurCol) = Head2
        For Z = 2 To 27
            If CurCol >= 3 Then
                Cells(Z, CurCol - 1) = Chr(Skipper) & Cells(Z, 1)
                Cells(Z, CurCol) = TheNumb
            Else
                Cells(Z, CurCol - 1) = Chr(Z + 63)
                Cells(Z, CurCol) = TheNumb
            End If
            TheNumb = TheNumb + 1
        Next Z

    Next CurCol
        Range(Cells(1, 1), Cells(Z, CurCol + 1)).Select
        Cells.EntireColumn.AutoFit
    For CurCol = 1 To LastCol Step 2
        Range(Cells(2, CurCol), Cells(27, CurCol)).Select
        Selection.Font.Bold = True
        Range(Cells(2, CurCol + 1), Cells(27, CurCol + 1)).Select
        Selection.HorizontalAlignment = xlCenter
    Next CurCol
    MsgBox "Done with " & TheNumb & " cells", vbInformation
End Sub


The client for whom I wrote this thing didn’t understand the concept of; just because your spreadsheet is 250 coluns wide is unweildly.

© MMXXVI

Updated:  05/08/2026 13:01
This page added:  08 May 2026