Function Shift(D As Range, DayShift As Boolean) As Long worked when I tested it

Have you tried snb's function and formula? It also goes in mod_Shift.

I noticed that all the formulas in the columns were CSE (Array) formulas. That gave me some issues.
Select H2 and press Enter. Repeat for G2 and H2. That should change the CSE formulas to ordinary formulas. Then copy F2:H2 down

Note that I had to remove (un check) a missing reference to get the function to work at all