PDA

View Full Version : Calculate a week later and then to fall always on Monday.



marreco
03-29-2012, 02:21 PM
I have a textbox1 where I type a date, I need another textbox2 the date of Monday of next week, ex.: 01/03/2012 date entered, and must appear in textbox2 the next Monday after a week. The expected result reported to date is 12/03/2012.


I need something like this function within the code.
= MAX (IF (WEEKDAY (A1 + ROW ($ A $ 1: $ A $ 15)) = 2, A1 + ROW ($ A $ 1: $ A $ 15)))

Bob Phillips
03-29-2012, 02:43 PM
MsgBox CDate(TextBox1.Value) - Weekday(TextBox1.Value, vbMonday) + 15

marreco
03-29-2012, 02:46 PM
in my case I'll type in TextBox1 and would result in Textbox2.

How would the code?


Thank you very much!

marreco
03-29-2012, 02:54 PM
I'm find way


Private Sub TextBox2_Enter()

Me.TextBox2 = CDate(TextBox1.Value) - Weekday(TextBox1.Value, vbMonday) + 15

End Sub
haha...:rotlaugh:

Thank you geniu!!!:hi:

Bob Phillips
03-29-2012, 04:23 PM
I see that you post at OzGrid, ExcelForum, CodeCage and Mr Excel (maybe more). What makes you decide too post what where, or are you just cross-posting on a grand scale?

marreco
03-29-2012, 04:42 PM
Not with this example!

This time you're wrong!

If you refer to previous posts on CASE.

It was the same spreadsheet, but with different ideas!

Bob Phillips
03-30-2012, 02:43 AM
I didn't say you did, I asked, and you avoided telling me.

marreco
03-30-2012, 01:44 PM
I do not understand English and sometimes get confused with the questions.

But in this case all my croos-Post, were different issues, although this was the same routine or WorkBook.

Understand that I am very curious I really want to learn VBA.

Forgive me for any inconvenience I caused!

Bob Phillips
03-30-2012, 02:24 PM
I am not saying your postings at other forums were cross-posting or were the same issue, I just asked. I was curious to why you post at so many, and what determines whether you post here or at one of the others. If you understand what I am asking and feel so inclined then I would like to know, but I will perfectly understand if you don't.