#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 29
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 896
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 78
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 29
Default 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
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
Macro sort Excel user New Users to Excel 1 August 1st 08 08:33 PM
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
Using Macro to sort without clicking on macro button dd Excel Discussion (Misc queries) 3 May 3rd 07 06:00 PM
Sort Macro Sprinks Excel Discussion (Misc queries) 1 April 19th 05 04:58 PM
Sort Macro Big Tony New Users to Excel 4 January 31st 05 02:17 PM


All times are GMT +1. The time now is 04:22 PM.

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"