Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 216
Default Finding column Letter

Hi.

Is there a way to return the column letter of a given
cell?

For instance, the following example code will return the
address of certain cell. In this case, it will
return "$I$1". I need, however, to return the column
letter of that cell. In this case, I would need it to
return "I".

Any ideas?

Thanks,
Mike.

Sub deleteme()
Dim MonthRange As Range
Dim i As Integer
Dim lastweek As Integer
Dim temp As String
Dim MonthCheck As Date
MonthCheck = #2/1/2004#
Set MonthRange = Worksheets("Blank 1").Range("e1:t1")
i = 1
Do While MonthRange(i) <= MonthCheck
i = i + 1
Loop
lastweek = i - 1
temp = MonthRange(lastweek).Address
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Finding column Letter

You can use this Mike

Function ColumnLetter(ColNumber) As String
'Chip Pearson
ColumnLetter = Left(Cells(1, ColNumber).Address(True, False), _
1 - (ColNumber 26))
End Function


Sub test()
MsgBox ColumnLetter(ActiveCell.Column)
End Sub


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"Mike" wrote in message ...
Hi.

Is there a way to return the column letter of a given
cell?

For instance, the following example code will return the
address of certain cell. In this case, it will
return "$I$1". I need, however, to return the column
letter of that cell. In this case, I would need it to
return "I".

Any ideas?

Thanks,
Mike.

Sub deleteme()
Dim MonthRange As Range
Dim i As Integer
Dim lastweek As Integer
Dim temp As String
Dim MonthCheck As Date
MonthCheck = #2/1/2004#
Set MonthRange = Worksheets("Blank 1").Range("e1:t1")
i = 1
Do While MonthRange(i) <= MonthCheck
i = i + 1
Loop
lastweek = i - 1
temp = MonthRange(lastweek).Address
End Sub



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 550
Default Finding column Letter

Mike,

From the Google archives (compliments of Jim Rech)

Left(ActiveCell.Address(, False), IIf(ActiveCell.Column 26, 2, 1))

John


"Mike" wrote in message
...
Hi.

Is there a way to return the column letter of a given
cell?

For instance, the following example code will return the
address of certain cell. In this case, it will
return "$I$1". I need, however, to return the column
letter of that cell. In this case, I would need it to
return "I".

Any ideas?

Thanks,
Mike.

Sub deleteme()
Dim MonthRange As Range
Dim i As Integer
Dim lastweek As Integer
Dim temp As String
Dim MonthCheck As Date
MonthCheck = #2/1/2004#
Set MonthRange = Worksheets("Blank 1").Range("e1:t1")
i = 1
Do While MonthRange(i) <= MonthCheck
i = i + 1
Loop
lastweek = i - 1
temp = MonthRange(lastweek).Address
End Sub



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
How do I turn excel columns from column number to column letter? column Setting up and Configuration of Excel 1 April 29th 08 10:15 AM
Lookup between sheets, finding a match, and returning a letter CSmith Excel Worksheet Functions 3 April 11th 08 07:08 PM
How to replace column letter in refferences with a function using the old column letter? Dmitry Kopnichev Links and Linking in Excel 6 October 13th 05 09:09 AM
How to replace column letter in refferences with a function using the old column letter? Dmitry Kopnichev Excel Worksheet Functions 6 October 13th 05 09:09 AM
column header changed from letter to number, how return to letter Ron Excel Discussion (Misc queries) 2 May 9th 05 08:34 PM


All times are GMT +1. The time now is 10:30 PM.

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"