View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Selecting a worksheet without making it active

With workSheets("AAA-Supervisor")
with .range(Y2:Z24")
.cells.Sort Key1:=.columns(1), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom,_
DataOption1:=xlSortNormal
end with
end with

And I bet you know your data. I wouldn't let excel guess whether you have
headers. I'd use xlyes or xlno.

ps. I think I got all your typos, but I didn't test it. It's better to copy
from the code window and paste directly into your message.



ordnance1 wrote:

How can I change my code below so the sort will perform without making
AAA-Supervisor the active shett?

Sheets("AAA-Supervisor").Select
range(Y2:Z24").Select
Selection.Sort Key1:=range("y4"). Order1:=x;Ascending, Header:=xlGuese, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom,_
DataOption1:=xlSortNormal


--

Dave Peterson