Looking for an Event Code to auto-sort a selection when the selection changes

bh24524

Board Regular
Joined
Dec 11, 2008
Messages
224
Office Version
  1. 2013
  2. 2007
As the title says, I am looking to see if an Event Code can be used in a tab called "VACATION CHART" to automatically sort a given range (A11:F42). There are formulas contained within all cells in that range, some of which are array formulas, just as an FYI if needed. In Cell B8, I have a Data Validation drop-down menu to select different shifts. When a new shift is selected in that cell, all of the information in cells A11:F42 automatically change to show only information about employees who are on that particular shift. If there are only 5 employees on that shift, it will leave the subsequent rows blank.

What I want the Event Code to do is every time that Dept. Shift in Cell B8 changes, to automatically sort A11:F42 by column C, then by Column D, and then by column B.

This is for Excel 2013. Based on the information I have given above, is this possible to do and would anyone happen to know the code I could add in to the Macros section?

A further question and probably the last step I might need on this whole project is if it is possible to also at the push of a key or button in the spreadsheet go through the entire list of shifts, save that tab as a new file name which automatically names it whatever is contained in cell B8, and also save it to a particular folder?

I am open to suggestions on this as to whether maybe an event code isn't even needed in that process and if it would be better to just incorporate the sorting of the range for each Dept. Shift as part of the overall macro that automatically saves the file names. Just as an FYI, there are currently 47 different shifts, so there would be up to 47 different files created.

I tried to give as much information that I could think would be pertinent to this but if more information is needed on this, please let me know and I can provide.
 

Some videos you may like

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying

Watch MrExcel Video

Forum statistics

Threads
1,127,498
Messages
5,625,123
Members
416,073
Latest member
JosGosth98

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top