This assumes the data starts with headers in row 1. All the used columns have
headers in row 1.
It assumes that the last row of the range to sort has data in column A.
Option Explicit
Sub testme01()
Dim wks As Worksheet
Dim myKeys As Variant
Dim FoundCell As Range
Dim iCtr As Long
Dim RngToSort As Range
Dim LastRow As Long
Dim LastCol As Long
'put these in the correct order
'Event is the primary key
'Key is the secondary key
'State is the tertiary key
'City is the quaternary key
'(I visited:
http://en.wiktionary.org/wiki/tertiary for that 4th one!)
myKeys = Array("Event", "Key", "State", "City")
Set wks = Worksheets("sheet1")
With wks
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
LastCol = .Cells(1, .Columns.Count).End(xlToLeft).Column
Set RngToSort = .Range("a1", .Cells(LastRow, LastCol))
For iCtr = UBound(myKeys) To LBound(myKeys) Step -1
With .Rows(1)
Set FoundCell = .Cells.Find(what:=myKeys(iCtr), _
after:=.Cells(.Cells.Count), _
LookIn:=xlValues, _
lookat:=xlWhole, _
searchorder:=xlByColumns, _
searchdirection:=xlNext, _
MatchCase:=False)
End With
If FoundCell Is Nothing Then
MsgBox myKeys(iCtr) & " wasn't found in row 1!" _
& vbLf & "Sort may not be correct!" _
& "That key is skipped!"
Else
RngToSort.Sort key1:=.Columns(FoundCell.Column), _
order1:=xlAscending, _
header:=xlYes
End If
Next iCtr
End With
End Sub