Week Commencing

Noz2k

Well-known Member
Joined
Mar 15, 2011
Messages
693
What I want to do is derive the date of the previous Monday from a date textbox.

the code I have at the moment is

Code:
ActiveCell.Offset(0, 69) = CDate(txtDate.Value) - Weekday(CDate(txtDate.Value), vbMonday)

However this returned 15/05/2011 (which was Sunday), where am I going wrong?
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Hi,

By previous Monday do you mean a week last monday (9th), or the monday just gone (16th)?

9th:

Code:
CDate(txtDate.Value) - (Weekday(CDate(txtDate.Value), 2) + 6)

16th:

Code:
CDate(txtDate.Value) - (Weekday(CDate(txtDate.Value), 3))
 
Upvote 0
Thanks, I wanted the most recent Monday (so the 16th)

Will this still work if the day was a Monday?

So if txtDate = 16/05/2011 would the result be the 16th or would it be the 9th?
 
Upvote 0
Also what I wish to do with that information, is on a button click, find the first instance of this weekdate occuring (in columnBS).

and then populate another sheet with all the corresponding values in the that row.

and then find the 2nd instance and populate a different part of the sheet with those corresponding values.

I'm fine with referencing the form and getting it to populate how I wish (I think).

But I'm not sure how to find the first instance? and then the 2nd?
 
Upvote 0

Forum statistics

Threads
1,224,599
Messages
6,179,828
Members
452,946
Latest member
JoseDavid

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