Public Sub SortColumn(strExcelFile As String, strWorksheet As String)
Dim objExcelApp As Excel.Application
Dim ws As Excel.Worksheet
Set objExcelApp = New Excel.Application
With objExcelApp
.Workbooks.Open FileName:=strExcelFile
.Visible = False
For Each ws In .Worksheets
If ws.Name = strWorksheet Then
.Range("A1:E" & .ActiveSheet.UsedRange.Rows.Count).Sort Key1:=Range("A2"), Order1:=xlAscending, Key2:=Range( _
"B2"), Order2:=xlAscending, Key3:=Range("D2"), Order3:=xlAscending, _
Header:=xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:= _
xlTopToBottom, DataOption1:=xlSortNormal, DataOption2:=xlSortNormal, DataOption3:=xlSortNormal
.Range("A1").Select
End If
Next ws
.DisplayAlerts = False
.ActiveWorkbook.SaveAs strExcelFile
.Quit
.DisplayAlerts = True
End With
Set objExcelApp = Nothing
End Sub