Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default Sort Method question

Good Day Group,

Below code works fine as long Sheet(3) is active. How to
write the code to work also when another WorkSheet is
the active sheet.? Is that possible?

Brgds

CG Rosén

Sheets(3).Columns("O:U").Sort Key1:=Range("O1"), Order1:=xlAscending,
Header:=xlNo, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortTextAsNumbers


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default Sort Method question

like this it should work..

Since you do not define the parent of sheets(3)
if will run on the ACTIVEworkbook.


WITH Sheets(3).Columns("O:U")
.Sort Key1:= .Cells(1), Order1:=xlAscending,
Header:=xlNo, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortTextAsNumbers
END WITH


keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"CG Rosén" wrote:

Good Day Group,

Below code works fine as long Sheet(3) is active. How to
write the code to work also when another WorkSheet is
the active sheet.? Is that possible?

Brgds

CG Rosén




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 923
Default Sort Method question


Try......

ActiveSheet.Columns("O:U").Sort Key1:=Range("O1"), Order1:=xlAscending,
Header:=xlNo, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortTextAsNumbers

Cheers
Nigel

"CG Rosén" wrote in message
...
Good Day Group,

Below code works fine as long Sheet(3) is active. How to
write the code to work also when another WorkSheet is
the active sheet.? Is that possible?

Brgds

CG Rosén

Sheets(3).Columns("O:U").Sort Key1:=Range("O1"), Order1:=xlAscending,
Header:=xlNo, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortTextAsNumbers




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA Sort method w/more than 3 Keys KenRoy Excel Discussion (Misc queries) 1 August 26th 05 10:48 PM
Sort Method Squid[_3_] Excel Programming 3 March 2nd 04 02:25 PM
Sort Method Questions pikus Excel Programming 2 February 3rd 04 03:46 PM
sort method frustration David Wenham Excel Programming 2 August 21st 03 06:26 PM
Sort method of range Richard Clarke Excel Programming 7 July 25th 03 04:42 PM


All times are GMT +1. The time now is 07:48 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"