VBA convert column number to letter

As you already know, rows in Excel are labeled with numbers, so it’s easy to get to that row by specifying a number. But it’s not that easy to go, for example, to 121st column because it’s labeled by one to three letter, so the first column is A and the last (16,384) is XFD.

In order to know, what label has the 121st column, you have to convert 121 to character label. You can achieve this by using an Excel formula.

This formula will take the numerical value from A2 and returns it as a column label. Let’s autofill this formula for the rest of the cells.

The formula works, but it’s quite complicated. Let’s create a function that we can call from the inside the worksheet, which takes only one parameter.

This VBA function gets one parameter, which indicated the column number, and returns label from A(1) to XFD(16,384). If the number is larger, it returns False.

As you can see, the VBA function also works.