Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default The column return value?????

How to make the Range("B10").Column returns B(or B$) not 2 ?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 923
Default The column return value?????

One way is to use Address and strip out to column element......

ColumnAddress = Mid(ActiveCell.Address, 1, InStrRev(ActiveCell.Address,
"$") - 1)


--
Cheers
Nigel



"OKLover" wrote in message
...
How to make the Range("B10").Column returns B(or B$) not 2 ?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default The column return value?????


Try this

Dim ColumnLetter As String
Dim Col As Long
Col = Range("B10").Column
ColumnLetter = Left(Cells(1, Col).Address(True, False), 1 - (Col 26))
MsgBox ColumnLetter


Or functions

'Chip Pearson

Function ColumnNumber(ColLetter) As Integer
ColumnNumber = Cells(1, ColLetter).Column
End Function

Temp = ColumnNumber("D") ' returns 4

To do the reverse, changing a number to a column letter, use

Function ColumnLetter(ColNumber) As String
ColumnLetter = Left(Cells(1, ColNumber).Address(True, False), _
1 - (ColNumber 26))
End Function

Temp = ColumnLetter(26) ' returns "Z"




--
Regards Ron de Bruin
http://www.rondebruin.nl


"OKLover" wrote in message ...
How to make the Range("B10").Column returns B(or B$) not 2 ?



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
Return column number from column header text Roger[_3_] Excel Discussion (Misc queries) 4 February 14th 08 09:40 PM
Return text in Column A if Column B and Column K match jeannie v Excel Worksheet Functions 4 December 13th 07 07:36 PM
Find max value in one column and return the value of corrosponding cell in different column [email protected] Excel Worksheet Functions 5 October 16th 07 12:33 PM
LOOKUP and return the column heading for IF/THEN return for False NN Excel Discussion (Misc queries) 1 October 6th 06 11:24 AM
Excel - Return column alphabet from column number Sathyaish Excel Programming 2 April 7th 04 02:40 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"