Hello Trien and Welcome to Excel Forum.
I believe that dflak's workhours macro will do what you want. Below is a link to the thread in which the macro is included.
https://www.excelforum.com/tips-and-...workhours.html
Let us know if you have any questions.