![]() |
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! |
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! |
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! |
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! |
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! |
All times are GMT +1. The time now is 01:52 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com