XLA routines: EE_TableHeadingCol

Nick's picture
EE_TableHeadingCol is a function that returns the column of a heading... if it doesn't find the heading, it returns 0
Function EE_TableHeadingCol(strFieldHeader As String, Optional rngTable As Range) As Long
'-Takes a heading name, EE_Table range
'- returns the heading col as a long
'http://excelexperts.com/xla-routines-eeTableHeadingCol    for updates on this function

    Set rngTable = EE_TableDefault(rngTable)
 
    On Error Resume Next
        EE_TableHeadingCol = Application.WorksheetFunction.Match(strFieldHeader, rngTable.Rows(1), 0)
        If Err.Number <> 0 Then
            EE_TableHeadingCol = 0
        End If
    Err.Clear: On Error GoTo 0: On Error GoTo -1
End Function