Get Dates for All Mondays in a Month

Kesey

New Member
Joined
Jul 9, 2006
Messages
36
Hello,

I'm working on a project where I request a Month (always the first of the month) and a day of the week from the user. Based on that date and day, I want to write out all of the Mondays (if that's the day entered) of the month to separate cells.

So for example, the user enters 4/1/2010 into cell A1 and Monday into cell A2. I would like a macro to write all of the Mondays in April to cells column B. Once the macro runs, column B should contain 4/5/2010, 4/12/2010, 4/19/2010, and 4/26/2010.

Similarly if the user entered 4/1/2010 and Wednesday, the macro would write 4/7/2010, 4/14/2010, 4/21/2010, and 4/28/2010 to cells in column B.

Any suggestions?

Thanks!
 
Looks like you're close #NAME?. When I enter 12/1/2010 as my date and Monday or Tuesday, dates in January (1/3/2011 and 1/4/2011) are returned for the fifth day so I'd still need the error checking--which I don't mind.
Ooops! :(

My fault. Just goes to show you that I didn't test this enough.

Simple fix.

Formula in B3 and then copied down to B6:

=IF(MONTH(B$2+ROWS(B$3:B3)*7)<>MONTH(A$1),"",B2+7)
 
Upvote 0

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().

Forum statistics

Threads
1,223,243
Messages
6,170,971
Members
452,371
Latest member
Frana

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