ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Column number in letters (https://www.excelbanter.com/excel-programming/299078-column-number-letters.html)

tich1234

Column number in letters
 
I have a spreadsheet where the column number is dynamic, ie it change
based on a access query from which the spreadsheet is exported.

Can anybody tell me how to find the column letter(like A,B, C...AA, AB
if I know the coulm number(like 1,2,3...27,28).

In other words how do I find the column letter if I know the colum
number.

Thanks,

William

--
Message posted from http://www.ExcelForum.com


Frank Kabel

Column number in letters
 
Hi
one way (in vBA):
msgbox
mid(cells(1,col_index).address,2,instr(2,cells(1,c ol_index).address,"$"
)-2)

--
Regards
Frank Kabel
Frankfurt, Germany

"tich1234 " schrieb im
Newsbeitrag ...
I have a spreadsheet where the column number is dynamic, ie it

changes
based on a access query from which the spreadsheet is exported.

Can anybody tell me how to find the column letter(like A,B, C...AA,

AB)
if I know the coulm number(like 1,2,3...27,28).

In other words how do I find the column letter if I know the column
number.

Thanks,

William,


---
Message posted from http://www.ExcelForum.com/



tich1234[_2_]

Column number in letters
 
Thanks Frank, worked great.
Willia

--
Message posted from http://www.ExcelForum.com


Rob van Gelder[_4_]

Column number in letters
 
I have an example on my website.

For archiving purposes:
Sub test()
Dim lngColumn As Long, strColumn As String

lngColumn = 27
strColumn = Split(Columns(lngColumn).Address(, False), ":")(1)
MsgBox strColumn
End Sub

--
Rob van Gelder - http://www.vangelder.co.nz/excel


"tich1234 " wrote in message
...
I have a spreadsheet where the column number is dynamic, ie it changes
based on a access query from which the spreadsheet is exported.

Can anybody tell me how to find the column letter(like A,B, C...AA, AB)
if I know the coulm number(like 1,2,3...27,28).

In other words how do I find the column letter if I know the column
number.

Thanks,

William,


---
Message posted from http://www.ExcelForum.com/




Dana DeLouis[_3_]

Column number in letters
 
One of a few other options:

n=26, or 27
ColumnLetter = Left$(Cells(n).Address(False, False), (n <= 26) + 2)

--
Dana DeLouis
Using Windows XP & Office XP
= = = = = = = = = = = = = = = = =


"tich1234 " wrote in message
...
I have a spreadsheet where the column number is dynamic, ie it changes
based on a access query from which the spreadsheet is exported.

Can anybody tell me how to find the column letter(like A,B, C...AA, AB)
if I know the coulm number(like 1,2,3...27,28).

In other words how do I find the column letter if I know the column
number.

Thanks,

William,


---
Message posted from http://www.ExcelForum.com/




Soo Cheon Jheong

Column number in letters
 
Hi

MsgBox Replace(Cells(1, col_index).Address(0, 0), 1, "")


--
Regards,
Soo Cheon Jheong
Seoul, Korea
_ _
^вп^
--




All times are GMT +1. The time now is 04:34 PM.

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