ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Column label based on column index (https://www.excelbanter.com/excel-programming/402780-column-label-based-column-index.html)

igorek

Column label based on column index
 
Is there a way to get a column label (A, B, ...AA, AB ) based on column
number. Lets say i have a column number 27 thus i want to see AA.

thanks
Ig



Niek Otten

Column label based on column index
 
=LEFT(ADDRESS(1,A1,4),LEN(ADDRESS(1,A1,4))-1)

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

"igorek" wrote in message ...
| Is there a way to get a column label (A, B, ...AA, AB ) based on column
| number. Lets say i have a column number 27 thus i want to see AA.
|
| thanks
| Ig
|
|



Leith Ross[_2_]

Column label based on column index
 
On Dec 14, 10:51 am, igorek wrote:
Is there a way to get a column label (A, B, ...AA, AB ) based on column
number. Lets say i have a column number 27 thus i want to see AA.

thanks
Ig


Hello lg,

Here is function that takes the column letter and returns the column
number.

Function ColNumber(Column_Letter As String) As Long

ColNumber = ActiveSheet.Cells(1, Column_Letter).Column

End Function


Example:
N = ColNumber("AA")

Sincerely,
Leith Ross


All times are GMT +1. The time now is 08:24 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com