Hi All
I need to format a sheet where the number of columns is not fixed. Sometimes the column name "Charged Date" is found in Column X or sometimes in Column Y etc. Basically I’d like to:
• Find the column header “Charge Date”
• Apply Autofilter to all columns
• Sort from Oldest to Newest (Charge Date)
I already use an array to id the the column headers and reorder the columns (see below) that I found on the forum.
Dim arrColOrder As Variant, ndx As Integer
Dim Find As Range, counter As Integer
arrColOrder = Array("Library Location", "o:loi", "Barcode1", "Barcode2", "Invoice Number", "Price", _
"Charge Date", "Title", "Author", "Publisher", "Location Mark", "Catalogue record", "Sigillum", "Loan Object Class", "Genre")
counter = 1
For ndx = LBound(arrColOrder) To UBound(arrColOrder)
Set Find = Rows("1:1").Find(arrColOrder(ndx), LookIn:=xlValues, LookAt:=xlWhole, _
SearchOrder:=xlByColumns, SearchDirection:=xlNext, MatchCase:=False)
If Not Find Is Nothing Then
If Find.Column <> counter Then
Find.EntireColumn.Cut
Columns(counter).Insert Shift:=xlToRight
Application.CutCopyMode = False
End If
counter = counter + 1
End If
Next ndx
There must be a way to use the same array to get the result I’m looking for or maybe there’s a faster way……… 
Attached is a sample of the actual sheet.
Bookmarks