Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Sort Macro
Can someone please help me create a button (macro) that will sort a column in
desending order? Basically I just want to push a button and have column "b" sort in desending order. Thanks! I am new to Macros. |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Sort Macro
Put the following in a standard module:
Sub demo() Columns("B:B").Sort Key1:=Range("B2"), Order1:=xlDescending, Header:=xlGuess, _ OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _ DataOption1:=xlSortNormal End Sub Sub ButtonMaker() Set r = ActiveCell ActiveSheet.Buttons.Add(177.75, 5.25, 36, 28.5).Select Selection.OnAction = "demo" r.Select End Sub The run the ButtonMaker macro. Macros are very easy to install and use: 1. ALT-F11 brings up the VBE window 2. ALT-I ALT-M opens a fresh module 3. paste the stuff in and close the VBE window If you save the workbook, the macro will be saved with it. To use the macro from the normal Excel window: 1. ALT-F8 2. Select the macro 3. Touch Run To remove the macro: 1. bring up the VBE window as above 2. clear the code out 3. close the VBE window To learn more about macros in general, see: http://www.mvps.org/dmcritchie/excel/getstarted.htm -- Gary''s Student - gsnu200848 "sross002" wrote: Can someone please help me create a button (macro) that will sort a column in desending order? Basically I just want to push a button and have column "b" sort in desending order. Thanks! I am new to Macros. |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Sort Macro
you wouldn't need a macro to achieve that
select any cell in range to be sorted in B column then click Z-A icon in the Standard tollbar On 23 Kwi, 14:40, sross002 wrote: Can someone please help me create a button (macro) that will sort a column in desending order? *Basically I just want to push a button and have column "b" sort in desending order. Thanks! *I am new to Macros. |
#4
Posted to microsoft.public.excel.misc
|
|||
|
|||
Sort Macro
sross002 skrev: Can someone please help me create a button (macro) that will sort a column in desending order? Basically I just want to push a button and have column "b" sort in desending order. Thanks! I am new to Macros. Try this one: Sub SorterB() Columns("B:B").Select Selection.Sort Key1:=Range("B1"), Order1:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _ DataOption1:=xlSortNormal End Sub After you have saved the VSB right clikk the mouse on tools and choose forms (scheme, pattern). Click on the butten yoy want to appere. Then click the place in the sheet you want to place it. The rest I thing you can manage. By the way- the easy way to du it is to record a macro. If you do any help to do that let me know |
#5
Posted to microsoft.public.excel.misc
|
|||
|
|||
Sort Macro
Thank you both!
But I can't find the "schemes, patterns" button on the Forms toolbar that SVERRE mentioned. "Sverre" wrote: sross002 skrev: Can someone please help me create a button (macro) that will sort a column in desending order? Basically I just want to push a button and have column "b" sort in desending order. Thanks! I am new to Macros. Try this one: Sub SorterB() Columns("B:B").Select Selection.Sort Key1:=Range("B1"), Order1:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _ DataOption1:=xlSortNormal End Sub After you have saved the VSB right clikk the mouse on tools and choose forms (scheme, pattern). Click on the butten yoy want to appere. Then click the place in the sheet you want to place it. The rest I thing you can manage. By the way- the easy way to du it is to record a macro. If you do any help to do that let me know |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro sort | New Users to Excel | |||
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort | Excel Worksheet Functions | |||
Using Macro to sort without clicking on macro button | Excel Discussion (Misc queries) | |||
Sort Macro | Excel Discussion (Misc queries) | |||
Sort Macro | New Users to Excel |