Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 20
Default Sort Column Script

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

  #2   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 5,441
Default Sort Column Script

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


"Bernie" wrote in message
ups.com...
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



  #3   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 20
Default Sort Column Script

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 Deitrick wrote:
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


"Bernie" wrote in message
ups.com...
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


  #4   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 5,441
Default Sort Column Script

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


"Bernie" wrote in message
oups.com...
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 Deitrick wrote:
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


"Bernie" wrote in message
ups.com...
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




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
Need Macro Help excelmad Excel Discussion (Misc queries) 7 January 19th 07 10:04 PM
Conditional Format as a MACRO Gunjani Excel Worksheet Functions 3 March 29th 06 05:22 PM
need help righting script to sort rows alphabetically then seperate them to line up [email protected] Excel Worksheet Functions 0 November 15th 05 01:23 AM
Sort as "reference column" kingjeremy Excel Discussion (Misc queries) 2 October 10th 05 11:41 PM
How do I sort a column of data and have each data row sort accordi Oedalis Excel Discussion (Misc queries) 1 March 17th 05 11:52 PM


All times are GMT +1. The time now is 06:59 AM.

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"