ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Returning column letter (https://www.excelbanter.com/excel-programming/403748-re-returning-column-letter.html)

Rick Rothstein \(MVP - VB\)

Returning column letter
 
Sorry that one didn't work on Columns with double letters i.e. "AA"
try this one instead
Dim x As Variant
x = Mid(ActiveCell.Columns.Address, 2, WorksheetFunction.Find("$", _
ActiveCell.Columns.Address, 2) - 2)


I think you can avoid the WorksheetFunction call by doing this...

x = Left(ActiveCell.Address(True, False), _
InStr(ActiveCell.Address(True, False), "$") - 1)

Rick


All times are GMT +1. The time now is 10:07 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com