Buttons for Macro Sorting


Posted by Christopher Manar on November 02, 2001 9:56 AM

I share a spreadsheet with two workers in other departments. Each of us accesses a large spreadsheet for different reasons, therefore we each want the data sorted a certain way for efficiency. I've never written a macro and what I want to do is program a button for each of 4 or 5 sort methods. For example, we track 3 separate order numbers, dates, Agent numbers, etc. Depending on the report we're reconciling, we want the workbook sorted a different way. Simple, but important.

Posted by Todd on November 02, 2001 11:28 AM

On one of the toolbars you can draw an option button in your spreadsheet. Then you can assign a macro to it. If you're not good at VB, you can record the macro, so that it records your actions.

Posted by Ken on November 02, 2001 11:39 AM

Hi Christopher,

Building a Macro is not difficult. Get to the worksheet you want to sort. Before you do the sort you want select "Tools" from the excel menu then "Macro" select "Record New Macro" type in a name for the macro that will make sense such as "Chris_sort" no spaces. Click OK. You are recording now so only do the things to run the sort. After you have finished all the things to run the sort select "Tools" from the excel menu then "Macro" then "Stop Recording". Now click "View" on the excel menu select "Toolbars" select "Forms" the Forms toolbar will be shown, you will need to click on the "Button" button select somewhere on the worksheet where you want the button. As soon as you place the button on the worksheet the dialog box will as you for a macro to assign to this button, find "Chris_Sort" macro click OK. Now if you right click over the button and drag your mouse over the button you can write "Chris's sort" for the button name. You have now wrote a sort macro with a button. You can now do the same thing for each sort that you need. By default buttons do not print so you will not change the look of what you are printing.

Thanks
Ken

Posted by . on November 02, 2001 2:22 PM

I wonder what Mark W thinks about this.



Posted by Christopher Manar on November 05, 2001 8:43 AM

Thanks for your help

Well, I'm giving it a shot. Thanks for the replies. This is a great recource.

CM