Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / January 2006

Tip: Looking for answers? Try searching our database.

Sort from row 4 down

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Desert Piranha - 25 Jan 2006 01:28 GMT
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.

Signature

Desert Piranha

Norman Jones - 25 Jan 2006 02:00 GMT
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

> Hi all,
>
[quoted text clipped - 11 lines]
>
> I thought setting the range would start at row 4 but guess not.
Desert Piranha - 25 Jan 2006 03:24 GMT
Norman Jones Wrote:
> Hi Desert Piranha,
>
[quoted text clipped - 53 lines]
> http://www.excelforum.com/showthread.php?threadid=504718
> >Hi Norman,

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

Thx again Norman

Signature

Desert Piranha

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.