Posted to microsoft.public.excel.programming
|
|
Help with hiding columns
Thanks to Tom and Leith for your suggestions! You sure sabved me a lot of
time experimenting.
"Leith Ross" wrote:
Hello ExcelDave,
In response to your first question, no there is not a built-in Excel or
VBA function to return the Column letter. You can easily write a macro
to do it. Add a Module to your VBA project and paste this code into it.
The macro can be called in VBA or used as a Worksheet function.
VBA Examples:
To return the Column of the Active Cell...
Ltr = ColumnLetter()
To Return the Column of specific Cell...
Ltr = Column(BT256)
Worksheet Examples:
To Return the Column of the Active Cell...
=ColumnLetter()
To Return the Column of a specific Cell...
=Column(BT256)
Macro Code:
Public Function ColumnLetter(Optional Address As Range) As String
Dim Addx
If Address Is Nothing Then
Addx = ActiveCell.Address(True, False)
Else
Addx = Address.Address(True, False)
End If
ColumnLetter = Left(Addx, InStr(1, Addx, "$") - 1)
End Function
Sincerely,
Leith Ross
--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=545727
|