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 / New Users / January 2007

Tip: Looking for answers? Try searching our database.

Sort Column Script

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bernie - 22 Jan 2007 14:51 GMT
I need to have a script in Excel that would allow the sorting of
columns from column "D" to the column before the last column with data.
I do not want the last column sorted.  The criteria for the sort is in
row 1 (Name of an employee).  Additional columns will be inserted
between column "D" and the last column so they need to be sorted.  I
hope this is clear.  Can someone please assist me?  Thank you!

Bernie
Bernie Deitrick - 22 Jan 2007 18:43 GMT
Bernie

How can someone named Bernie NOT know how to do this?   ;-)

Sub BernieSort()
   Range(Range(Range("D1"), Range("D1").End(xlDown)), _
     Range("D1").End(xlToRight)(1, 0)).Sort _
     Key1:=Range("D1"), Order1:=xlAscending, Header:=xlNo, _
       OrderCustom:=1, MatchCase:=False, Orientation:=xlLeftToRight, _
       DataOption1:=xlSortNormal
End Sub

HTH,
Bernie
MS Excel MVP

>I need to have a script in Excel that would allow the sorting of
> columns from column "D" to the column before the last column with data.
[quoted text clipped - 4 lines]
>
> Bernie
Bernie - 23 Jan 2007 16:32 GMT
LOL, that's because this Bernie is not a genius and you are.

It works perfectly, thank you so much for the help.

Bernie

> Bernie
>
[quoted text clipped - 20 lines]
> >
> > Bernie
Bernie Deitrick - 23 Jan 2007 17:52 GMT
Bernie,

Glad to hear that it worked OK for you.  We all have to start with _zero_
experience - soem of us have just been around longer than others....

Bernie

> LOL, that's because this Bernie is not a genius and you are.
>
[quoted text clipped - 26 lines]
>> >
>> > Bernie
 
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.