PC Review


Reply
Thread Tools Rate Thread

Column index returned - how to get the Letter

 
 
=?Utf-8?B?QXJ0dXJv?=
Guest
Posts: n/a
 
      15th Feb 2007
x = ActiveCell.Column
Returns 1 for column A

How do I get x = A?

Hmmm

Arturo
 
Reply With Quote
 
 
 
 
Jim Cone
Guest
Posts: n/a
 
      15th Feb 2007
Arturo,

Function GetColumn(ByRef lngColumnNum As Long) As String
GetColumn = Application.Substitute(Cells(1, _
lngColumnNum).Address(False, False), "1", vbNullString)
End Function
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware


"Arturo" <(E-Mail Removed)>
wrote in message
x = ActiveCell.Column
Returns 1 for column A
How do I get x = A?
Hmmm
Arturo
 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      15th Feb 2007
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
 
Reply With Quote
 
=?Utf-8?B?QXJ0dXJv?=
Guest
Posts: n/a
 
      15th Feb 2007
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
>

 
Reply With Quote
 
=?Utf-8?B?QXJ0dXJv?=
Guest
Posts: n/a
 
      15th Feb 2007
thanks.

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


"Jim Cone" wrote:

> Arturo,
>
> Function GetColumn(ByRef lngColumnNum As Long) As String
> GetColumn = Application.Substitute(Cells(1, _
> lngColumnNum).Address(False, False), "1", vbNullString)
> End Function
> --
> Jim Cone
> San Francisco, USA
> http://www.realezsites.com/bus/primitivesoftware
>
>
> "Arturo" <(E-Mail Removed)>
> wrote in message
> x = ActiveCell.Column
> Returns 1 for column A
> How do I get x = A?
> Hmmm
> Arturo
>

 
Reply With Quote
 
Jim Cone
Guest
Posts: n/a
 
      15th Feb 2007

That won't work in XL 97.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware



"Arturo" <(E-Mail Removed)>
wrote in message
thanks.
Dim arr As Variant
arr = Split(ActiveCell.Address, "$")
MsgBox arr(1)



"Jim Cone" wrote:
> Arturo,
> Function GetColumn(ByRef lngColumnNum As Long) As String
> GetColumn = Application.Substitute(Cells(1, _
> lngColumnNum).Address(False, False), "1", vbNullString)
> End Function

--
> Jim Cone
> San Francisco, USA
> http://www.realezsites.com/bus/primitivesoftware




> "Arturo" <(E-Mail Removed)>
> wrote in message
> x = ActiveCell.Column
> Returns 1 for column A
> How do I get x = A?
> Hmmm
> Arturo
>

 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      15th Feb 2007
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
 
Reply With Quote
 
Tom Ogilvy
Guest
Posts: n/a
 
      16th Feb 2007
That would be the slowest way to do it. Enjoy.

--
Regards,
Tom Ogilvy


"Arturo" <(E-Mail Removed)> wrote in message
news:CB3BCEB1-2B27-4BC2-AEC9-(E-Mail Removed)...
> 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
>>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Column letter to index Radon Microsoft Excel Misc 3 2nd Feb 2009 05:29 AM
Re: Translate Column Index Num to Letter Ron Rosenfeld Microsoft Excel Misc 1 8th Dec 2006 03:37 PM
Re: Translate Column Index Num to Letter T. Valko Microsoft Excel Misc 1 8th Dec 2006 04:31 AM
Re: Translate Column Index Num to Letter Gord Dibben Microsoft Excel Misc 0 7th Dec 2006 11:26 PM
Re: Translate Column Index Num to Letter Jon Peltier Microsoft Excel Misc 0 7th Dec 2006 10:03 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:41 AM.