Vba column number to cell address in Excel

This is the inverse of the previous chapter, that is, to extract column number from Range address.

This scenario arises, when column number of a particular cell containing a particular data is required.

This requirement is most common in some applications, which requires the column number of a particular address.

The excel has a way to achieve this too, as explained below.

The following example demonstrates this

  1. Sub col_num()
  2. Dim col_num As Integer
  3. Dim col_name As String
  4. col_name = InputBox("Enter an alphabet")
  5. col_num = Sheets("Q37").Range(col_name & 1).Column
  6. MsgBox col_num
  7. End Sub

The above example obtains a column name alphabet from the user and converts it to the corresponding column number.

Make sure to enter alphabet only, else, it will result in an error.

The screenshot of the editor is as shown below:

excel vba column number to cell address

The result of the above example is as shown below:

excel vba column number to cell address

excel vba column number to cell address

 

You can find similar Excel Questions and Answer hereunder

1) I want to add a trend indicator symbol next to my sales data - how can I do that?

2) How can I quickly navigate to a frequently used field in a voluminous worbook?

3) How can I generate random numbers between 2 limits?

4) How do i apply a formula to an entire column in Excel

5) In a Table , how can I add a Total Row that displays the maximum value in a column of numbers?

6) Vlookup to return multiple values in same cell in Excel

7) How can I find the number of working days between 2 dates given a holidays list?

8) Concatenate number with text but keeping in number format in Excel

9) Highlight row of selected cell in Excel

10) How can I convert Column numbers into Column names for use in range definition?

 

Here the previous and next chapter