Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Column Name from Column Number in Excel 1

Status
Not open for further replies.

rick360

Technical User
May 24, 2004
11
US
In Excel-2000, I need to get, in VBA, the column name from the column number (example: column #28 is column "AB". This seems like this should be simple, yet I can't find it anywhere(excel help or searching here). I know there has to be a simpler way than writing a function to do this.

Thanks,
Rick
 
Something like this ?
Left(Cells(,28).Address(True,False), InStr(Cells(,28).Address(True,False),"$")-1

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Another way:
Split(Columns(28).Address(False,False),":")(0)

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 

Lots of ways to skin a cat...
Code:
MsgBox Split(Cells(, 28).Address(True, False), "$")(0)

Skip,
[sub]
[glasses] [red]Be advised:[/red]When Viscounts were guillotined just as they were disclosing where their jewels were hidden, it shows to go that you should...
Never hatchet your Counts before they chicken! [tongue][/sub]
 
That works, however it wasn't quite as simple as I had thought. Thanks a bunch, I'd have never figured that out. Have a star for your very quick and effective help.

Rick
 
the simplest solution is probably

Code:
Column_Name = Chr$(28 + 64)

Bravos1
 
Bravos1, Chr$(28 + 64) is [highlight]\[/highlight] ...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top