Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default 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/


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Column number in letters

Thanks Frank, worked great.
Willia

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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,236
Default 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/



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 690
Default 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/





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Column number in letters

Hi

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


--
Regards,
Soo Cheon Jheong
Seoul, Korea
_ _
^ąŻ^
--


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
using row number or column letters in formula Chris Excel Worksheet Functions 5 November 22nd 09 07:07 PM
Excel, how do I change the column headings from letters to number lazybee Excel Discussion (Misc queries) 4 April 2nd 08 07:44 AM
How can I change column designation from number to letters? Japansper Excel Discussion (Misc queries) 3 November 2nd 07 03:22 PM
how can I sort a column that consists of sizes (letters not number new2xl Charts and Charting in Excel 1 September 15th 07 06:32 PM
how i write a number on a column A and see that number on letters. Mauricio Excel Worksheet Functions 2 March 12th 06 09:29 PM


All times are GMT +1. The time now is 07:39 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"