Two steps to this
1 - put the data in "Work Pattern" into a table, this makes it easier to refer to in the vba (to do this, unmerge cell m3:m4 and select the range "A4:M8" and click the "Table" button in the "Insert" tab of the ribbon, make sure "My table has headers" is checked. Once done, click anywhere in the table, goto the "Table Design" tab in the ribbon and name the table "WorkPattern").
2 - open VBA editor, in the project explorer double click on "Sheet4 ("Detailed (employee view)", in the window paste the following code - each line in the code has a comment telling you what it does.
Bookmarks