Automatically Find First and Last Working Day in Month

How to automatically find first and last working day in any month using VBA.

Below is the recorded and optimized code:
Option Explicit

Sub FirstLastWorkingDayInMonth()

‘ FirstLastWorkingDayInMonth Macro
‘ How to find the first and last working day in a month given any date of the month

‘ActiveCell.FormulaR1C1 = “First working Day”
‘ActiveCell.FormulaR1C1 = _
‘Selection.NumberFormat = “m/d/yyyy”
‘ActiveCell.FormulaR1C1 = “1-Jan-2020”
‘ActiveCell.FormulaR1C1 = “Last Working Day”
‘ActiveCell.FormulaR1C1 = _
‘ActiveCell.FormulaR1C1 = _
‘ Selection.NumberFormat = “m/d/yyyy”
‘ ActiveCell.FormulaR1C1 = “1/15/2020”
‘ActiveCell.FormulaR1C1 = “1/31/2020”
‘ActiveCell.FormulaR1C1 = “1/26/2020”
Range(“A2”) = “First Working Day”
Range(“C2”) = “=WORKDAY(DATE(YEAR(R[-1]C),MONTH(R[-1]C),1)-1,1,RC[2]:R[3]C[2])”
Range(“C2”).NumberFormat = “m/d/yyyy”

Range(“A3”) = “Last Working Day” Range(“C3”) = “=WORKDAY(DATE(YEAR(R[-2]C),MONTH(R[-2]C)+1,1),-1,R[-1]C[2]:R[2]C[2])” Range(“C3”).NumberFormat = “m/d/yyyy”

End Sub

Published by

Dinesh Kumar Takyar

Welcome to! My aim is to help you learn MS Excel including VBA. I always felt that a good way to learn something was to find solutions to problems in that domain. That is why I share these Excel videos with you. Mostly these are questions asked during my corporate training sessions. I've been training individuals and companies in computers since 1991. I did my B. Sc. (Vordiplom), M. Sc. (Diplom) and Ph.D. (Dr. rer. nat.) from Hamburg, Germany. The best thing about solving some of my visitor's questions is that I also gain new insights. For more Excel VBA solutions you may like to visit my YouTube channel: For a structured Excel VBA training course online you can visit:

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.