![]() |
Sorting Automatically
I have many worksheets in a shared workbook. My users will input data on any
or all sheets. I would like the sheets to automatically sort (by 3 columns - Sales Agent; Customer; Invoice#) when they exit the file. I created a macro to do the sort. So, if I hit CTRL-S it will sort just fine but I'd rather it be done automatically. Can anyone help me with this? Thanks! Paula |
Sorting Automatically
one method would be to call sort macro in closing. add the following
private sub Auto_Close call sortmacro end sub "paulas" wrote: I have many worksheets in a shared workbook. My users will input data on any or all sheets. I would like the sheets to automatically sort (by 3 columns - Sales Agent; Customer; Invoice#) when they exit the file. I created a macro to do the sort. So, if I hit CTRL-S it will sort just fine but I'd rather it be done automatically. Can anyone help me with this? Thanks! Paula |
Sorting Automatically
I wouldn't put it in the auto_close or before_close procedure. The user may say
no to the "do you want to save your changes?" prompt. Instead, run the code when the user opens the workbook. Option Explicit Sub Auto_Open() 'code to do the sort 'or call YourProcedureThatSortsTheDataHere End sub This would go in a general module--not behind thisworkbook. paulas wrote: I have many worksheets in a shared workbook. My users will input data on any or all sheets. I would like the sheets to automatically sort (by 3 columns - Sales Agent; Customer; Invoice#) when they exit the file. I created a macro to do the sort. So, if I hit CTRL-S it will sort just fine but I'd rather it be done automatically. Can anyone help me with this? Thanks! Paula -- Dave Peterson |
Sorting Automatically
Thank you! That's what I needed!!
"Dave Peterson" wrote: I wouldn't put it in the auto_close or before_close procedure. The user may say no to the "do you want to save your changes?" prompt. Instead, run the code when the user opens the workbook. Option Explicit Sub Auto_Open() 'code to do the sort 'or call YourProcedureThatSortsTheDataHere End sub This would go in a general module--not behind thisworkbook. paulas wrote: I have many worksheets in a shared workbook. My users will input data on any or all sheets. I would like the sheets to automatically sort (by 3 columns - Sales Agent; Customer; Invoice#) when they exit the file. I created a macro to do the sort. So, if I hit CTRL-S it will sort just fine but I'd rather it be done automatically. Can anyone help me with this? Thanks! Paula -- Dave Peterson |
All times are GMT +1. The time now is 08:20 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com