PC Review


Reply
Thread Tools Rate Thread

Convert column # to the letter of the alphabet

 
 
JimRich
Guest
Posts: n/a
 
      25th Nov 2009
In the following code the uCol value is a number, I need the actual column
letter. Is there an easy way to convert the # to the correct column letter.
I could us an array or a function with a select case but I have at least 180
columns that have to be done. The code is used to determine the location of
a particular Agent's sales data for poping up a chart using that data.

uAdd = ActiveWindow.RangeSelection.Address
uCol = Range(uAdd).Column

Thanks!
 
Reply With Quote
 
 
 
 
Rick Rothstein
Guest
Posts: n/a
 
      25th Nov 2009
Try this...

uAdd = ActiveWindow.RangeSelection.Address(1, 0)
uCol = Split(uAdd, "$")(0)

--
Rick (MVP - Excel)


"JimRich" <(E-Mail Removed)> wrote in message
news:369804FC-8AD6-483A-98B6-(E-Mail Removed)...
> In the following code the uCol value is a number, I need the actual column
> letter. Is there an easy way to convert the # to the correct column
> letter.
> I could us an array or a function with a select case but I have at least
> 180
> columns that have to be done. The code is used to determine the location
> of
> a particular Agent's sales data for poping up a chart using that data.
>
> uAdd = ActiveWindow.RangeSelection.Address
> uCol = Range(uAdd).Column
>
> Thanks!


 
Reply With Quote
 
Jacob Skaria
Guest
Posts: n/a
 
      25th Nov 2009
Do you mean

uAdd = ActiveWindow.RangeSelection.Address
uCol = Replace(Cells(1, Range(uAdd).Column).Address(False, False), "1", "")

If this post helps click Yes
---------------
Jacob Skaria


"JimRich" wrote:

> In the following code the uCol value is a number, I need the actual column
> letter. Is there an easy way to convert the # to the correct column letter.
> I could us an array or a function with a select case but I have at least 180
> columns that have to be done. The code is used to determine the location of
> a particular Agent's sales data for poping up a chart using that data.
>
> uAdd = ActiveWindow.RangeSelection.Address
> uCol = Range(uAdd).Column
>
> Thanks!

 
Reply With Quote
 
Rick Rothstein
Guest
Posts: n/a
 
      25th Nov 2009
Actually, here is my same method of approach but where you can leave the
first line of code exactly as you originally posted it...

uAdd = ActiveWindow.RangeSelection.Address
uCol = Split(uAdd, "$")(1)

--
Rick (MVP - Excel)


"Rick Rothstein" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Try this...
>
> uAdd = ActiveWindow.RangeSelection.Address(1, 0)
> uCol = Split(uAdd, "$")(0)
>
> --
> Rick (MVP - Excel)
>
>
> "JimRich" <(E-Mail Removed)> wrote in message
> news:369804FC-8AD6-483A-98B6-(E-Mail Removed)...
>> In the following code the uCol value is a number, I need the actual
>> column
>> letter. Is there an easy way to convert the # to the correct column
>> letter.
>> I could us an array or a function with a select case but I have at least
>> 180
>> columns that have to be done. The code is used to determine the location
>> of
>> a particular Agent's sales data for poping up a chart using that data.
>>
>> uAdd = ActiveWindow.RangeSelection.Address
>> uCol = Range(uAdd).Column
>>
>> Thanks!

>


 
Reply With Quote
 
Rainer Bielefeld
Guest
Posts: n/a
 
      25th Nov 2009
Hi Jim,

try

Debug.Print "# " + Left(Cells(1, uCol).Address(rowabsolute:=True, columnabsolute:=False), InStr(1, Cells(1,
uCol).Address(rowabsolute:=True, columnabsolute:=False), "$", vbTextCompare) - 1)

Maybe a little bit tricky ;-)

Regards,

billy

"JimRich" <(E-Mail Removed)> schrieb im Newsbeitrag news:369804FC-8AD6-483A-98B6-(E-Mail Removed)...
> In the following code the uCol value is a number, I need the actual column
> letter. Is there an easy way to convert the # to the correct column letter.
> I could us an array or a function with a select case but I have at least 180
> columns that have to be done. The code is used to determine the location of
> a particular Agent's sales data for poping up a chart using that data.
>
> uAdd = ActiveWindow.RangeSelection.Address
> uCol = Range(uAdd).Column
>
> Thanks!


 
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
Convert Column Number to Column Letter Philosophaie Microsoft Excel Programming 1 5th Mar 2010 09:08 PM
Convert Column number to a letter? e.g. Column 203 = GU M Skabialka Microsoft Excel Discussion 11 29th Jul 2009 05:12 PM
Adding a number to a letter of the alphabet to get a letter mike_ward99@hotmail.com Microsoft Excel Worksheet Functions 5 21st May 2007 04:25 PM
Macro to Click on Alphabet Letter to go to Cell Where that Alphabet Letter Starts in Large Spreadsheet jcp370@comcast.net Microsoft Excel Discussion 2 26th Jul 2005 07:33 AM
convert column number to letter(s) =?Utf-8?B?U2NvdHQ=?= Microsoft Excel Worksheet Functions 1 13th Nov 2003 04:59 PM


Features
 

Advertising
 

Newsgroups
 


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