Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Convert column # to the letter of the alphabet

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!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Convert column # to the letter of the alphabet

Try this...

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

--
Rick (MVP - Excel)


"JimRich" wrote in message
...
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!


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Convert column # to the letter of the alphabet

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" wrote in message
...
Try this...

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

--
Rick (MVP - Excel)


"JimRich" wrote in message
...
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!



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Convert column # to the letter of the alphabet

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!

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Convert column # to the letter of the alphabet

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" schrieb im Newsbeitrag ...
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
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
Adding a number to a letter of the alphabet to get a letter [email protected] Excel Worksheet Functions 5 May 21st 07 04:25 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
check for alphabet in datalabel and then superscript that letter Jyotsna Excel Programming 4 October 4th 05 09:22 PM


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