View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Sort without Selecting

I think this is my current "standard" for sorting.

' SortcpModels
with Sheets("cpModels")
with .range("a:b")
.sort key1:=.columns(1), order1:=xlascending, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
end with
end with

I like that I can use .columns(1) to specify the key(s).

ssjody wrote:

My current code for Sorting selects the sheet, sorts the data then
returns back to my Data Entry sheet. How can I have this perform this
without the code selecting the sheet? I just want it to happen in the
background without the sheets flashing back and forth while this
happens.

I did a search and found some suggestions but can't find one that works
for my application.

Thanks Jody

' SortcpModels
Sheets("cpModels").Select
Columns("A:B").Select
Selection.Sort Key1:=Range("A2"), Order1:=xlAscending,
Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Sheets("Data Entry").Select
Range("B3").Select


--

Dave Peterson