P
Patrick Simonds
The code below works great if the active worksheet is Employee_List, but
if I call it from another active worksheet, I get a Sort referance not
valid. This is supoose to sort the data on the Employee_List worksheet,
while leaving me on the current (active worksheet)
Private Sub CommandButton1_Click()
'Sort by Paratransit Drivers First Name
Worksheets("Employee_List").Range("AA1").Value = 1
Dim wks As Worksheet
Set wks = Worksheets("Employee_List")
With wks.Range("A1:Z300")
..Sort Key1:=Range("B2"), Order1:=xlAscending, Key2:=Range("C2") _
, Order2:=xlAscending, Key3:=Range("A2"), Order3:=xlAscending,
Header:= _
xlYes, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom,
_
DataOption1:=xlSortNormal, DataOption2:=xlSortNormal, DataOption3:=
_
xlSortNormal
End With
End Sub
if I call it from another active worksheet, I get a Sort referance not
valid. This is supoose to sort the data on the Employee_List worksheet,
while leaving me on the current (active worksheet)
Private Sub CommandButton1_Click()
'Sort by Paratransit Drivers First Name
Worksheets("Employee_List").Range("AA1").Value = 1
Dim wks As Worksheet
Set wks = Worksheets("Employee_List")
With wks.Range("A1:Z300")
..Sort Key1:=Range("B2"), Order1:=xlAscending, Key2:=Range("C2") _
, Order2:=xlAscending, Key3:=Range("A2"), Order3:=xlAscending,
Header:= _
xlYes, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom,
_
DataOption1:=xlSortNormal, DataOption2:=xlSortNormal, DataOption3:=
_
xlSortNormal
End With
End Sub