Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Column index name

Dear ALL,

I got a question that maybe a minor one to everyone. but anyway, if I know
the column number, how do I know what "alphabeth letter" refer to it? E.g.
I know the value c = 5 as referring column 5, but is there a way to return
the column letter "E" instead of 5? Please help since will need to use it
for setting formula inside macro. Many many thanks.

Regards,
John


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Column index name

Range("Z21").Formula = "Sum(" & Cells(3,c).Resize(10,1).Address & ")"

Generally you don't need the column letter by itself.


However,

Left(columns(c).Address(0,0),1 + -1*(c 26))


from the immediate window:
c = 5
? Left(columns(c).Address(0,0),1 + -1*(c 26))
E
c = 27
? Left(columns(c).Address(0,0),1 + -1*(c 26))
AA

--
Regards,
Tom Ogilvy

"John" wrote in message
...
Dear ALL,

I got a question that maybe a minor one to everyone. but anyway, if I know
the column number, how do I know what "alphabeth letter" refer to it?

E.g.
I know the value c = 5 as referring column 5, but is there a way to return
the column letter "E" instead of 5? Please help since will need to use it
for setting formula inside macro. Many many thanks.

Regards,
John




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Column index name

You generally don't need to do this in a macro. instead of

Sheets("Sheet1").Range(Chr(64 + n) & "2").Formula = "=SUM(A1:B1)"

for instance, use

Sheets("Sheet1").Cells(2, n).Formula = "=SUM(A1:B1)"

or, if your range is in the formula:

Range("B1").Formula = _
"=SUM(" & Cells(2, n).Resize(10, 1).Address(0, 0) & ")"


In article ,
"John" wrote:

I got a question that maybe a minor one to everyone. but anyway, if I know
the column number, how do I know what "alphabeth letter" refer to it? E.g.
I know the value c = 5 as referring column 5, but is there a way to return
the column letter "E" instead of 5? Please help since will need to use it
for setting formula inside macro. Many many thanks.

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
Display index of column headers in column A MZ Excel Discussion (Misc queries) 9 January 17th 10 06:35 PM
Column index Geo Excel Discussion (Misc queries) 2 August 4th 09 01:06 AM
Naming of column index Freshman Excel Worksheet Functions 2 October 30th 07 07:57 AM
Using an Index by Column Headings instead of Column Numbers Sean Bishop New Users to Excel 2 November 21st 06 09:38 PM
Column Index Megan Excel Worksheet Functions 2 November 11th 04 02:09 PM


All times are GMT +1. The time now is 11:24 PM.

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

About Us

"It's about Microsoft Excel"