Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ed Ed is offline
external usenet poster
 
Posts: 399
Default Return column letter, rather than number?

Dim rng As Range
Dim cll As Range
Set rng = Selection

For Each cll In rng.Cells
MsgBox "Cell " & cll.Column & cll.Row & "has a value of " & cll.Value
Next cll

Is there a way to format the .Column property to show the column letter
designation instead of returning the column number?

Ed


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 272
Default Return column letter, rather than number?

No, however try this:
Msgbox cll.Address(False,False) & " Has a value of: " & cll
--
Charles Chickering

"A good example is twice the value of good advice."


"Ed" wrote:

Dim rng As Range
Dim cll As Range
Set rng = Selection

For Each cll In rng.Cells
MsgBox "Cell " & cll.Column & cll.Row & "has a value of " & cll.Value
Next cll

Is there a way to format the .Column property to show the column letter
designation instead of returning the column number?

Ed



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 138
Default Return column letter, rather than number?

Good question to which I believe the answer is no.

I've only managed to return an alpha reference by
a) using the address property and then striping out the Alpha portion
whilst avoiding the $s (unless you use rowabsolute/column absolute) or
b) by converting the returned column ref to an ASCII character
reference - but if you are only using the first 26 columns or
c) by using the returned reference number to look up the alpha
reference in an predefined array - it's a pain setting up the array if
you expect to return columns with "high" ref numbers

I hope someone else knows better!

Alan

Ed wrote:
Dim rng As Range
Dim cll As Range
Set rng = Selection

For Each cll In rng.Cells
MsgBox "Cell " & cll.Column & cll.Row & "has a value of " & cll.Value
Next cll

Is there a way to format the .Column property to show the column letter
designation instead of returning the column number?

Ed


  #4   Report Post  
Posted to microsoft.public.excel.programming
Ed Ed is offline
external usenet poster
 
Posts: 399
Default Return column letter, rather than number?

Thanks for the reply, Alan. Stripping out the Alpha from the Address seems
to be the answer.
Ed

"Alan" wrote in message
ps.com...
Good question to which I believe the answer is no.

I've only managed to return an alpha reference by
a) using the address property and then striping out the Alpha portion
whilst avoiding the $s (unless you use rowabsolute/column absolute) or
b) by converting the returned column ref to an ASCII character
reference - but if you are only using the first 26 columns or
c) by using the returned reference number to look up the alpha
reference in an predefined array - it's a pain setting up the array if
you expect to return columns with "high" ref numbers

I hope someone else knows better!

Alan

Ed wrote:
Dim rng As Range
Dim cll As Range
Set rng = Selection

For Each cll In rng.Cells
MsgBox "Cell " & cll.Column & cll.Row & "has a value of " &
cll.Value
Next cll

Is there a way to format the .Column property to show the column letter
designation instead of returning the column number?

Ed




  #5   Report Post  
Posted to microsoft.public.excel.programming
Ed Ed is offline
external usenet poster
 
Posts: 399
Default Return column letter, rather than number?

Thanks, Charles. I appreciate the boost.
Ed

"Charles Chickering" wrote in
message ...
No, however try this:
Msgbox cll.Address(False,False) & " Has a value of: " & cll
--
Charles Chickering

"A good example is twice the value of good advice."


"Ed" wrote:

Dim rng As Range
Dim cll As Range
Set rng = Selection

For Each cll In rng.Cells
MsgBox "Cell " & cll.Column & cll.Row & "has a value of " &
cll.Value
Next cll

Is there a way to format the .Column property to show the column letter
designation instead of returning the column number?

Ed





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
Function that will look at letter in a column and return a number locasciok1 Excel Worksheet Functions 4 November 11th 09 06:31 AM
Column() to return a letter instead of a number? cKBoy Excel Worksheet Functions 16 February 17th 06 04:50 AM
Return Current Column Letter and Row Number Carroll[_2_] Excel Programming 5 June 23rd 05 03:37 PM
column header changed from letter to number, how return to letter Ron Excel Discussion (Misc queries) 2 May 9th 05 08:34 PM
How to return the row number or column letter as a variable? Gerrit van Stempvoort Excel Programming 4 May 1st 04 10:39 AM


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