There's no code. Just a formula in cell H50 copied down and across. Cells F50:G59 have Data Validation to select shift start or end at 15 minute intervals. Row 60 has totals (for the test area).

In principle, this doesn't require VBA. It's possible to drop the formula into new rows using a Worksheet Change Event handler but, personally, I think that would be overkill.

You could achieve much the same outcome by using a Structured Table. You'd have to get rid of the merged cells ... but I’d do that anyway and just double the height of each row.

I'd also move the reference data elsewhere, for example, onto the second sheet that I added. Being realistic, I wouldn't have thought you'd want to print this and having it way over on the right isn't that convenient for referring to it.

If you want a VBA solution, please clarify your requirements/expectations based on the updated example.