Hi, I would you like ask to for help with my succsess. Night work start from 22:00 (10:00PM) end ending at 06:00 (06:00AM). I prepare one formula whicht calculated corectli day and night shifts but i cant implement to the macro.

Formula to day working horus is :

"=MAX(;MIN($J$1;IF(C2<B2;1;0)+C2-E2)-MAX(B2;$I$1))+IF(AND(C2>$I$1;B2>C2);C2-$I$1;0)"

how I can translate it to the VBA code or how i create in VBA formulas for paste this functions to .cells(y,1)?

thank you for help