Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Fred
 
Posts: n/a
Default How to extract just the Column Name of the active cell

Hello,
Does anyone know how to extract only the Column Name of an active cell in
another cell. e.g. If active cell is D4 then I want the "D" to be extract and
displayed in another cell say A1. Let me know.

Regards,
Fred
  #2   Report Post  
Posted to microsoft.public.excel.misc
Bob Phillips
 
Posts: n/a
Default How to extract just the Column Name of the active cell


Debug.Print ColumnLetter(activecell.Column)


'-----------------------------------------------------------------
Function ColumnLetter(Col As Long)
'-----------------------------------------------------------------
Dim sColumn As String
On Error Resume Next
sColumn = Split(Columns(Col).Address(, False), ":")(1)
On Error GoTo 0
ColumnLetter = sColumn
End Function

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Fred" wrote in message
...
Hello,
Does anyone know how to extract only the Column Name of an active cell

in
another cell. e.g. If active cell is D4 then I want the "D" to be extract

and
displayed in another cell say A1. Let me know.

Regards,
Fred



  #3   Report Post  
Posted to microsoft.public.excel.misc
David Billigmeier
 
Posts: n/a
Default How to extract just the Column Name of the active cell

Not the best to look at, but it will work:

=LEFT(SUBSTITUTE(CELL("address"),"$",""),IF(ISNUMB ER(--(MID(SUBSTITUTE(CELL("address"),"$",""),2,1))),1,2 ))


--
Regards,
Dave


"Fred" wrote:

Hello,
Does anyone know how to extract only the Column Name of an active cell in
another cell. e.g. If active cell is D4 then I want the "D" to be extract and
displayed in another cell say A1. Let me know.

Regards,
Fred

  #4   Report Post  
Posted to microsoft.public.excel.misc
Ron de Bruin
 
Posts: n/a
Default How to extract just the Column Name of the active cell

Hi Fred

You must use a event for this in the sheet module

Try this

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Column 26 Then
Range("A1").Value = Left(Cells(Target.Row, Target.Column).Address(False, False), 2)
Else
Range("A1").Value = Left(Cells(Target.Row, Target.Column).Address(False, False), 1)
End If
End Sub



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


"Fred" wrote in message ...
Hello,
Does anyone know how to extract only the Column Name of an active cell in
another cell. e.g. If active cell is D4 then I want the "D" to be extract and
displayed in another cell say A1. Let me know.

Regards,
Fred



  #5   Report Post  
Posted to microsoft.public.excel.misc
Duke Carey
 
Posts: n/a
Default How to extract just the Column Name of the active cell

It doesn't update very well, but...

=CHAR(CELL("col")+64)

"Fred" wrote:

Hello,
Does anyone know how to extract only the Column Name of an active cell in
another cell. e.g. If active cell is D4 then I want the "D" to be extract and
displayed in another cell say A1. Let me know.

Regards,
Fred

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
IF/AND/OR/DATEIF Issue...sorry...long post... EDSTAFF Excel Worksheet Functions 1 November 10th 05 12:28 AM
creating a bar graph Johnfli Excel Discussion (Misc queries) 0 October 26th 05 08:16 PM
Find a empty cell in next column Michael Excel Discussion (Misc queries) 3 June 15th 05 02:18 PM
Unable to set the active cell from VBA HMS New Users to Excel 1 December 7th 04 09:56 PM
GET.CELL Biff Excel Worksheet Functions 2 November 24th 04 07:16 PM


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