View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Column index returned - how to get the Letter

Was this a test?

Arturo wrote:

Thank you.

Dim arr As Variant
arr = Split(ActiveCell.Address, "$")
MsgBox arr(1)

"Dave Peterson" wrote:

One way:

Option Explicit
Function ColLetter(rng As Range) As String
Dim myStr As String
With rng.Parent
myStr = .Cells(1, rng.Column).Address(0, 0)
myStr = Left(myStr, Len(myStr) - 1)
End With
ColLetter = myStr
End Function

And I could test it with:
Sub testme()
MsgBox ColLetter(ActiveCell)
End Sub



Arturo wrote:

x = ActiveCell.Column
Returns 1 for column A

How do I get x = A?

Hmmm

Arturo


--

Dave Peterson


--

Dave Peterson