Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Sort from row 4 down


Hi all,

Why won't this sort the range below row 3, or in other words,
the first 3 rows have data, so the sort will start in row 4 and go
down.

Columns("A:J").Select
Selection.Sort _
Key1:=Range("A4"), Order1:=xlAscending, _
Key2:=Range("C4"), Order2:=xlAscending, _
Key3:=Range("B4"), Order3:=xlAscending, _
Header:=xlYes, OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom

I thought setting the range would start at row 4 but guess not.


--
Desert Piranha


------------------------------------------------------------------------
Desert Piranha's Profile: http://www.excelforum.com/member.php...o&userid=28934
View this thread: http://www.excelforum.com/showthread...hreadid=504718

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Sort from row 4 down

Hi Desert Piranha,

Try :

'=============
Public Sub Tester()
Dim rng As Range

Set rng = Intersect(Columns("A:J"), ActiveSheet.UsedRange)

Set rng = rng.Offset(3). _
Resize(rng.Rows.Count - 3, rng.Columns.Count)

rng.Sort _
Key1:=Range("A4"), Order1:=xlAscending, _
Key2:=Range("C4"), Order2:=xlAscending, _
Key3:=Range("B4"), Order3:=xlAscending, _
Header:=xlYes, OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom

End Sub
'<<=============


---
Regards,
Norman



"Desert Piranha"
<Desert.Piranha.2262jy_1138152603.1292@excelforu m-nospam.com wrote in
message news:Desert.Piranha.2262jy_1138152603.1292@excelfo rum-nospam.com...

Hi all,

Why won't this sort the range below row 3, or in other words,
the first 3 rows have data, so the sort will start in row 4 and go
down.

Columns("A:J").Select
Selection.Sort _
Key1:=Range("A4"), Order1:=xlAscending, _
Key2:=Range("C4"), Order2:=xlAscending, _
Key3:=Range("B4"), Order3:=xlAscending, _
Header:=xlYes, OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom

I thought setting the range would start at row 4 but guess not.


--
Desert Piranha


------------------------------------------------------------------------
Desert Piranha's Profile:
http://www.excelforum.com/member.php...o&userid=28934
View this thread: http://www.excelforum.com/showthread...hreadid=504718



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Sort from row 4 down


Norman Jones Wrote:
Hi Desert Piranha,

Try :

'=============
Public Sub Tester()
Dim rng As Range

Set rng = Intersect(Columns("A:J"), ActiveSheet.UsedRange)

Set rng = rng.Offset(3). _
Resize(rng.Rows.Count - 3, rng.Columns.Count)

rng.Sort _
Key1:=Range("A4"), Order1:=xlAscending, _
Key2:=Range("C4"), Order2:=xlAscending, _
Key3:=Range("B4"), Order3:=xlAscending, _
Header:=xlYes, OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom

End Sub
'<<=============


---
Regards,
Norman



"Desert Piranha"
<Desert.Piranha.2262jy_1138152603.1292@excelforu m-nospam.com wrote in
message
news:Desert.Piranha.2262jy_1138152603.1292@excelfo rum-nospam.com...

Hi all,

Why won't this sort the range below row 3, or in other words,
the first 3 rows have data, so the sort will start in row 4 and go
down.

Columns("A:J").Select
Selection.Sort _
Key1:=Range("A4"), Order1:=xlAscending, _
Key2:=Range("C4"), Order2:=xlAscending, _
Key3:=Range("B4"), Order3:=xlAscending, _
Header:=xlYes, OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom

I thought setting the range would start at row 4 but guess not.


--
Desert Piranha



------------------------------------------------------------------------
Desert Piranha's Profile:
http://www.excelforum.com/member.php...o&userid=28934
View this thread:

http://www.excelforum.com/showthread...hreadid=504718
Hi Norman,


Thx much, works fine, now to try to finish this project before
daylight.

Thx again Norman


--
Desert Piranha


------------------------------------------------------------------------
Desert Piranha's Profile: http://www.excelforum.com/member.php...o&userid=28934
View this thread: http://www.excelforum.com/showthread...hreadid=504718

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
Updating workbook with an alpha sort sheet and a numeric sort shee cjlatta Excel Discussion (Misc queries) 2 January 28th 09 12:00 AM
sort function for dates does not sort properly in Office 2007 Exc. Rosalie Excel Worksheet Functions 1 November 22nd 07 10:25 PM
Pls. reply Sort Data and copy to next coulmn when sort order chang shital shah Excel Programming 1 August 19th 05 02:51 PM
Excel sort by Fill Color by custom list sort Dash4Cash Excel Discussion (Misc queries) 2 July 29th 05 10:45 PM
sort (on part of) string - originally posted under Tricky Sort Tom Ogilvy Excel Programming 0 August 6th 04 02:42 AM


All times are GMT +1. The time now is 04:56 PM.

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

About Us

"It's about Microsoft Excel"