![]() |
Selects a letter
I need a macro that selects the letter out of a cell address without the $
sign. Thanks for your help in advance. Severn |
Selects a letter
Example please?
"Roger B." wrote in message ... I need a macro that selects the letter out of a cell address without the $ sign. Thanks for your help in advance. Severn |
Selects a letter
Try this
Sub test() If ActiveCell.Column 26 Then MsgBox Left(ActiveCell.Address(False, False), 2) Else MsgBox Left(ActiveCell.Address(False, False), 1) End If End Sub -- Regards Ron de Bruin http://www.rondebruin.nl "Roger B." wrote in message ... I need a macro that selects the letter out of a cell address without the $ sign. Thanks for your help in advance. Severn |
Selects a letter
This little macro does what you want.
Sub GetColLetter() Dim c As Range Set c = ActiveCell MsgBox Left(c.Address(0, 0), 2 + (c.Column <= 26)) End Sub HTH Otto "Roger B." wrote in message ... I need a macro that selects the letter out of a cell address without the $ sign. Thanks for your help in advance. Severn |
Selects a letter
One way:
CellAddr = Left(ActiveCell.Address(True, False), InStr(1, ActiveCell.Address(True, False), "$") - 1) "Roger B." wrote: I need a macro that selects the letter out of a cell address without the $ sign. Thanks for your help in advance. Severn |
Selects a letter
That will work in any current version of Excel. However, it won't
work in the next version of Excel. For Excel 12 compatibility, use Dim Rng As Range Dim ColLetter As String Set Rng = ActiveCell ColLetter = Split(Rng.Address(True, True, xlA1), "$")(1) Debug.Print ColLetter -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Otto Moehrbach" wrote in message ... This little macro does what you want. Sub GetColLetter() Dim c As Range Set c = ActiveCell MsgBox Left(c.Address(0, 0), 2 + (c.Column <= 26)) End Sub HTH Otto "Roger B." wrote in message ... I need a macro that selects the letter out of a cell address without the $ sign. Thanks for your help in advance. Severn |
Selects a letter
Chip
Do you have a source for info (differences) in Excel 12? Otto "Chip Pearson" wrote in message ... That will work in any current version of Excel. However, it won't work in the next version of Excel. For Excel 12 compatibility, use Dim Rng As Range Dim ColLetter As String Set Rng = ActiveCell ColLetter = Split(Rng.Address(True, True, xlA1), "$")(1) Debug.Print ColLetter -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Otto Moehrbach" wrote in message ... This little macro does what you want. Sub GetColLetter() Dim c As Range Set c = ActiveCell MsgBox Left(c.Address(0, 0), 2 + (c.Column <= 26)) End Sub HTH Otto "Roger B." wrote in message ... I need a macro that selects the letter out of a cell address without the $ sign. Thanks for your help in advance. Severn |
Selects a letter
This Blog is very good Otto
http://blogs.msdn.com/excel/default.aspx -- Regards Ron de Bruin http://www.rondebruin.nl "Otto Moehrbach" wrote in message ... Chip Do you have a source for info (differences) in Excel 12? Otto "Chip Pearson" wrote in message ... That will work in any current version of Excel. However, it won't work in the next version of Excel. For Excel 12 compatibility, use Dim Rng As Range Dim ColLetter As String Set Rng = ActiveCell ColLetter = Split(Rng.Address(True, True, xlA1), "$")(1) Debug.Print ColLetter -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Otto Moehrbach" wrote in message ... This little macro does what you want. Sub GetColLetter() Dim c As Range Set c = ActiveCell MsgBox Left(c.Address(0, 0), 2 + (c.Column <= 26)) End Sub HTH Otto "Roger B." wrote in message ... I need a macro that selects the letter out of a cell address without the $ sign. Thanks for your help in advance. Severn |
Selects a letter
Thanks Ron. Otto
"Ron de Bruin" wrote in message ... This Blog is very good Otto http://blogs.msdn.com/excel/default.aspx -- Regards Ron de Bruin http://www.rondebruin.nl "Otto Moehrbach" wrote in message ... Chip Do you have a source for info (differences) in Excel 12? Otto "Chip Pearson" wrote in message ... That will work in any current version of Excel. However, it won't work in the next version of Excel. For Excel 12 compatibility, use Dim Rng As Range Dim ColLetter As String Set Rng = ActiveCell ColLetter = Split(Rng.Address(True, True, xlA1), "$")(1) Debug.Print ColLetter -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Otto Moehrbach" wrote in message ... This little macro does what you want. Sub GetColLetter() Dim c As Range Set c = ActiveCell MsgBox Left(c.Address(0, 0), 2 + (c.Column <= 26)) End Sub HTH Otto "Roger B." wrote in message ... I need a macro that selects the letter out of a cell address without the $ sign. Thanks for your help in advance. Severn |
All times are GMT +1. The time now is 09:22 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com