Function used to return column NUMBER from range.
‘rng’ is the range containing the header sought
‘hdr’ is the string being sought, and is CASE SENSITIVE
Author: michael@excelexperts.co.uk
Function myhdrcol(Rng As Range, hdr As String) As Long Dim mycount As Long Dim x As Long Dim rngarray As Variant Dim c As Range If Rng Is Nothing Then Exit Function Set rngarray = Rng mycount = 0 For Each c In rngarray If c.Value = hdr Then mycount = mycount + 1 x = c.Column End If Next c If mycount = 1 Then myhdrcol = x Else myhdrcol = 0 End If End Function