GetColumnName, ColumnName_XOffset

Gets the column name from a cell address.
Returns "E" from "E45", or "BR" from "BR92"
Can pass "Column_Offset" to get column name of another column related to cell address
It used to be 3 functions, got combined into one
Example:
GetColumnName("F3", -2)
will return "D"

CodeFunctionName
What is this?

Public

Tested

Original Work
Function GetColumnName(CellAddress, Optional Columns_Offset = 0)
    'IFS_Col = Range(CellAddress).Address(True, False)
    'If Columns_Offset < > 0 Then IFS_Col = Range(CellAddress).Offset(, Columns_Offset).Address(True, False)
    IFS_Col = Range(CellAddress).Offset(, Columns_Offset).Address(True, False)
    StFro = 1
    If InStr(1, IFS_Col, "!") > 0 Then StFro = InStr(1, IFS_Col, "!") + 1
    GetColumnName = Mid(IFS_Col, StFro, InStr(1, IFS_Col, "$") - StFro)
End Function

CellAddress, Optional Columns_Offset

GetColumnName("F3", -2)
will return "D"

Views 3,389

Downloads 1,357

CodeID
DB ID