View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.newusers,microsoft.public.excel.misc,microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Excel - Return column alphabet from column number

activecell.Address

will give you row and column.

to get just the column

Left(activecell.Address(0,0), 1 +(-1*(activecell.Column 26)))

or
Left(activecell.Address(0,0), 2 + (activecell.Column <= 26))

--
Regards,
Tom Ogilvy


"Sathyaish" wrote in message
om...
Is there some function in Excel (VBA) that will get me the column
alphabet if I provide the column number, or do I have to write one. I
ask because I know that there is, yet I recall I wrote this
functionality for the previous application, and I don't want to:

(1) Reuse it, if there's something in-built
(2) Re-invent the wheel

Help!

PS: I'm looking for something like:




code:-----------------------------------------------------------------------
---------
Function GetAlphabet(ByVal ColumnNumber as Long) as String
--------------------------------------------------------------------------

------


which if I call must say:



code:-----------------------------------------------------------------------
---------
GetAlphabet(1)
--------------------------------------------------------------------------

------


Output: "A"