L
Legacy 15162
Guest
I am utilizing access to dump data in an excel spreadsheet. after the data is dumped, i would like to sort the data by a specific column in excel. I already have a named range called sort that was defined in excel. how can i get this code to work properly?
If xlWS.Name = "Outerlier Report" Then
xlWS.Range("B5") = TxtBeginPeriod & " THRU " & TxtEndPeriod
xlWS.Cells.Name("SORT").Activate
xlWS.Cells.Sort Key1:=Range("V12"), Order1:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
End If
If xlWS.Name = "Outerlier Report" Then
xlWS.Range("B5") = TxtBeginPeriod & " THRU " & TxtEndPeriod
xlWS.Cells.Name("SORT").Activate
xlWS.Cells.Sort Key1:=Range("V12"), Order1:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
End If