Automatic sorting

%3CLINGO-SUB%20id%3D%22lingo-sub-1911056%22%20slang%3D%22en-US%22%3EAutomatic%20sorting%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1911056%22%20slang%3D%22en-US%22%3E%3CP%3EHello.%20I%20have%20an%20Excel%20worksheet%20that%20I%20use%20to%20track%20projects.%20In%20an%20ideal%20world%2C%20I%20would%20like%20the%20data%20to%20automatically%20sort%20based%20on%20two%20columns%20(due%20date%20and%20status).%20As%20I%20change%20the%20status%20from%20Pending%20to%20Complete%2C%20I%20would%20like%20it%20to%20sort%20z--%26gt%3Ba%2C%20the%20completed%20items%20move%20to%20the%20bottom%20of%20the%20list.%20I%20would%20also%20like%20sorting%20by%20due%20date%20so%20the%20pending%20items%20with%20shortest%20timeframe%20are%20on%20top.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20use%20MS%20Office%20365%2C%20and%20I%20can't%20figure%20it%20out.%20Is%20it%20even%20possible%3F%20If%20so%2C%20how%20do%20I%20set%20it%20up%3F%26nbsp%3B%3C%2FP%3E%3CP%3E%3CBR%20%2F%3EThanks!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1911056%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EOffice%20365%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1911884%22%20slang%3D%22en-US%22%3ERe%3A%20Automatic%20sorting%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1911884%22%20slang%3D%22en-US%22%3E%3CP%3EHello%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F875373%22%20target%3D%22_blank%22%3E%40David_Cox1201%3C%2FA%3E%26nbsp%3B%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EHow%20automatic%20do%20you%20need%20this%20to%20be%3F%20If%20your%20data%20is%20in%20an%20Excel%20Table%2C%20then%20you%20can%20sort%20by%20the%20table%20headers.%20Everything%20else%20will%20require%20programming.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20you%20need%20this%20to%20happen%20automatically%2C%20then%20you%20can%20start%20the%20macro%20recorder%2C%20then%20sort%20the%20data%2C%20then%20stop%20the%20macro%20recorder.%20After%20that%20you%20can%20configure%20Excel%20to%20run%20the%20macro%20whenever%20the%20data%20changes.%20This%20can%20be%20done%20with%20a%20Worksheet_Change%20event.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Foffice%2Fvba%2Fapi%2Fexcel.worksheet.change%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Foffice%2Fvba%2Fapi%2Fexcel.worksheet.change%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor

Hello. I have an Excel worksheet that I use to track projects. In an ideal world, I would like the data to automatically sort based on two columns (due date and status). As I change the status from Pending to Complete, I would like it to sort z-->a, the completed items move to the bottom of the list. I would also like sorting by due date so the pending items with shortest timeframe are on top.

 

I use MS Office 365, and I can't figure it out. Is it even possible? If so, how do I set it up? 


Thanks!

2 Replies

Hello @David_Cox1201 ,

 

How automatic do you need this to be? If your data is in an Excel Table, then you can sort by the table headers. Everything else will require programming.

 

If you need this to happen automatically, then you can start the macro recorder, then sort the data, then stop the macro recorder. After that you can configure Excel to run the macro whenever the data changes. This can be done with a Worksheet_Change event.

 

https://docs.microsoft.com/en-us/office/vba/api/excel.worksheet.change

@Ingeborg Hawighorst Thank you! I've recorded the macro. I'm a novice here, so pardon my ignorance...but I can't figure out how to configure Excel to run it when the data changes. I clicked the link, but where do I set up the Worksheet Change Event?