Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 281
Default Sorting a sheet by VBA

Hi,

i need to sort my worksheet in my VBA code i used the code below but it
doesn't work:

RCnt = Cells(Rows.Count, 2).End(xlUp).Row
Range("A1:Q" & Trim(Str(RCnt + 2))).Sort Key1:=Range("A2"),
Order1:=xlAscending, Key2:=Range _
("B2"), Order2:=xlAscending, Key3:=Range("E2"), Order3:=xlAscending, _
Header:=xlYes, OrderCustom:=1, MatchCase:=False, Orientation:= _
xlTopToBottom, DataOption1:=xlSortNormal, DataOption2:=xlSortNormal, _
DataOption3:=xlSortNormal

any help would be appreciated.

Thanks,
--
Farhad Hodjat
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4,339
Default Sorting a sheet by VBA

What doesn't work? It appeared to work OK for me.

"Farhad" wrote:

Hi,

i need to sort my worksheet in my VBA code i used the code below but it
doesn't work:

RCnt = Cells(Rows.Count, 2).End(xlUp).Row
Range("A1:Q" & Trim(Str(RCnt + 2))).Sort Key1:=Range("A2"),
Order1:=xlAscending, Key2:=Range _
("B2"), Order2:=xlAscending, Key3:=Range("E2"), Order3:=xlAscending, _
Header:=xlYes, OrderCustom:=1, MatchCase:=False, Orientation:= _
xlTopToBottom, DataOption1:=xlSortNormal, DataOption2:=xlSortNormal, _
DataOption3:=xlSortNormal

any help would be appreciated.

Thanks,
--
Farhad Hodjat

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 281
Default Sorting a sheet by VBA

Hi,

Thank you for your reply, it suppose to sort my sheet based on the condition
i determined but nothing would happen to my sheet.

Thanks,
--
Farhad Hodjat


"Toppers" wrote:

What doesn't work? It appeared to work OK for me.

"Farhad" wrote:

Hi,

i need to sort my worksheet in my VBA code i used the code below but it
doesn't work:

RCnt = Cells(Rows.Count, 2).End(xlUp).Row
Range("A1:Q" & Trim(Str(RCnt + 2))).Sort Key1:=Range("A2"),
Order1:=xlAscending, Key2:=Range _
("B2"), Order2:=xlAscending, Key3:=Range("E2"), Order3:=xlAscending, _
Header:=xlYes, OrderCustom:=1, MatchCase:=False, Orientation:= _
xlTopToBottom, DataOption1:=xlSortNormal, DataOption2:=xlSortNormal, _
DataOption3:=xlSortNormal

any help would be appreciated.

Thanks,
--
Farhad Hodjat

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
Sorting a protected sheet Rusty Excel Worksheet Functions 1 April 19th 07 03:10 AM
Protect Sheet but allow sorting LucyK Excel Worksheet Functions 4 December 20th 06 11:30 PM
SORTING TO ANOTHER SHEET cityfc Excel Discussion (Misc queries) 1 February 2nd 06 05:01 PM
Sorting rows to a another sheet Dataminer Excel Worksheet Functions 6 December 7th 05 07:23 PM
Sorting a sheet JohnnyJomp Excel Worksheet Functions 3 May 30th 05 08:12 PM


All times are GMT +1. The time now is 07:16 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"