Dates of working days in a month

karthick.in

New Member
Joined
May 12, 2011
Messages
8
Is there anyway that I can populate the list of dates (only working days) in a month?

For example:
Cell A1 has the drop down list of all the months (Jan to Dec)
Cell A2 has the drop down of year (2011, 2012, 2013, ...)

If I select "Dec" in A1 and "2011" in A2, then column A3 should have the date of first working day in the month, B3 should have the date of next working day in the month, C3 should have the date next to it, etc...

In this case A3 = 01/12/2011; B3 = 02/12/2011; C3 = 05/12/2011 .... V3 = 30/12/2011

This should work for whatever month and year I select in A1 and A2.

The solution to do this would be much appreciated. Thanks!
 
Last edited:

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Assign this macro to a button and away you go :)
Code:
Sub a()
    sd = DateValue("01 " & [A1] & " " & [A2])
    cd = sd
    i = 1
    While Month(cd) = Month(sd)
        If Weekday(cd, vbMonday) < 6 Then
            Cells(3, i) = cd
            i = i + 1
        End If
        cd = cd + 1
    Wend
End Sub
 
Upvote 0
The formula is B2 is just to be dragged across columns (i.e. there are only teo unique formulas in the post - A2 and B2).
 
Upvote 0
Assign this macro to a button and away you go :)
Code:
Sub a()
    sd = DateValue("01 " & [A1] & " " & [A2])
    cd = sd
    i = 1
    While Month(cd) = Month(sd)
        If Weekday(cd, vbMonday) < 6 Then
            Cells(3, i) = cd
            i = i + 1
        End If
        cd = cd + 1
    Wend
End Sub
Many Thanks!
 
Upvote 0

Forum statistics

Threads
1,223,239
Messages
6,170,947
Members
452,368
Latest member
jayp2104

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top