Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default convert column number to letter

Try this User Defined Function

Function GetColLet(ColNumber As Integer) As String
GetColLet = Left(Cells(1, ColNumber).Address(False, False), _
1 - (ColNumber 26))
End Function

usage is =GetColLet(25) will return Y

Can be called from a Sub

Sub getlet()
Dim numcol As Integer
numcol = InputBox("enter a number")
MsgBox "The column is " & GetColLet(numcol)
End Sub


Gord Dibben Excel MVP

On 24 Oct 2005 12:29:55 -0700, "lvcha.gouqizi"
wrote:

If I know a cell's column number is 25, how can I know what letter its
column represent? Just like that, the column 2 is actually column "B".
Thanks.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 128
Default convert column number to letter

Convert the sheet to letter:-

With Application
.ReferenceStyle = x1R1C1
.EnableSound = False
.RollZoom = False
End With
End Sub


Convert the sheet to numbers:-

With Application
.ReferenceStyle = xlR1C1
.StandardFont = "Arial"
.StandardFontSize = "10"
.EnableSound = False
.RollZoom = False
End With
End Sub


--
Message posted via http://www.officekb.com
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
Column Header - Convert a Number to a letter stickandrock Excel Discussion (Misc queries) 1 June 9th 08 07:54 PM
convert column number to letter Harald Staff Excel Programming 7 October 25th 05 03:42 PM
convert column number to letter lvcha.gouqizi Excel Programming 1 October 24th 05 09:37 PM
convert column number to letter Bob Phillips[_6_] Excel Programming 0 October 24th 05 09:03 PM


All times are GMT +1. The time now is 08:15 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"