Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 138
Default Use macro to sort column

I have 3 columns of info-B,C,D.
I want to sort the numbers in D in ascending order, but I need the info in B
and C to stay with the number in D.
I do not want to do it through "sort" because 5 worksheets has 77 rows, and
the sorting is in sections in those 77 rows. If you can show me the macro for
the first section, Rows 6-18, I can figure out the rest. Please do not leave
anything out of the macro, like the beginning and the end words, because I
cannot write them, I can only edit the ranges.
Thank You!
Paula
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,722
Default Use macro to sort column

Macro to sorts B6:D18 by column D:

Sub SortByColumnD()
'Change first range as needed
'Do not change Key1
Range("B6:D18").Sort Key1:=Range("D1"), _
Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom, _
DataOption1:=xlSortTextAsNumbers
End Sub
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"Paula" wrote:

I have 3 columns of info-B,C,D.
I want to sort the numbers in D in ascending order, but I need the info in B
and C to stay with the number in D.
I do not want to do it through "sort" because 5 worksheets has 77 rows, and
the sorting is in sections in those 77 rows. If you can show me the macro for
the first section, Rows 6-18, I can figure out the rest. Please do not leave
anything out of the macro, like the beginning and the end words, because I
cannot write them, I can only edit the ranges.
Thank You!
Paula

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 138
Default Use macro to sort column

It worked perfect-thanks!!

"Luke M" wrote:

Macro to sorts B6:D18 by column D:

Sub SortByColumnD()
'Change first range as needed
'Do not change Key1
Range("B6:D18").Sort Key1:=Range("D1"), _
Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom, _
DataOption1:=xlSortTextAsNumbers
End Sub
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"Paula" wrote:

I have 3 columns of info-B,C,D.
I want to sort the numbers in D in ascending order, but I need the info in B
and C to stay with the number in D.
I do not want to do it through "sort" because 5 worksheets has 77 rows, and
the sorting is in sections in those 77 rows. If you can show me the macro for
the first section, Rows 6-18, I can figure out the rest. Please do not leave
anything out of the macro, like the beginning and the end words, because I
cannot write them, I can only edit the ranges.
Thank You!
Paula

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
How to sort without including column headings in sort OPDvolunteer Excel Discussion (Misc queries) 4 March 11th 09 04:08 PM
Auto-Sort Won't Sort All Column Cells TikiTembo Excel Discussion (Misc queries) 1 March 25th 08 07:00 PM
Macro To Sort By Column Header Names Derek Hart Excel Worksheet Functions 6 December 26th 07 09:41 PM
data, sort option is grayed. how to sort on a column? Steve Richter Excel Discussion (Misc queries) 1 September 25th 07 03:25 PM
How can I sort one column and have the entire row sort. (binding) Blue Excel Worksheet Functions 10 November 13th 05 07:09 PM


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