Sub DynamicSort()
Dim sortAdd As String
Dim sortRange As Range
' Find which column "Date" appears in
On Error GoTo err_chk
Rows("1:1").Find(What:="Date", After:=Range("A1"), LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
On Error GoTo 0
sortAdd = ActiveCell.Address(0, 0)
' Convert entries in Date column to valid dates
Columns(ActiveCell.Column).TextToColumns Destination:=Range(sortAdd), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo _
:=Array(1, 3), TrailingMinusNumbers:=True
' Format columns
Columns(ActiveCell.Column).NumberFormat = "[$-409]m/d/yy h:mm AM/PM;@"
' Set sort range by using current region
Range("A1").CurrentRegion.Sort _
key1:=Range(sortAdd), order1:=xlAscending, Header:=xlYes
Exit Sub
' Error handling
err_chk:
If Err.Number = 91 Then
MsgBox "No header row with title of Date", vbOKOnly, "ERROR!"
Else
MsgBox Err.Number & ": " & Err.Description
End If
End Sub