Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
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
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
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
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to sort without including column headings in sort | Excel Discussion (Misc queries) | |||
Auto-Sort Won't Sort All Column Cells | Excel Discussion (Misc queries) | |||
Macro To Sort By Column Header Names | Excel Worksheet Functions | |||
data, sort option is grayed. how to sort on a column? | Excel Discussion (Misc queries) | |||
How can I sort one column and have the entire row sort. (binding) | Excel Worksheet Functions |