jamescooper
Well-known Member
- Joined
- Sep 8, 2014
- Messages
- 834
Hello,
Trying to format textbox3 when a date is entered, working out whether it is a Monday/Tuesday/Wednesday/Thursday/Friday/Saturday or Sunday.
Then upon this calculation, I want to reformat the day of the week so that it adds 6 days if it is Monday (for example).
The first part works but the reformatting and adding doesn't quite.
Any ideas.
Thanks.
Trying to format textbox3 when a date is entered, working out whether it is a Monday/Tuesday/Wednesday/Thursday/Friday/Saturday or Sunday.
Then upon this calculation, I want to reformat the day of the week so that it adds 6 days if it is Monday (for example).
The first part works but the reformatting and adding doesn't quite.
Any ideas.
Thanks.
VBA Code:
Private Sub TextBox3_AfterUpdate()
Dim tDate As Date
If TextBox3.Text <> "" Then
tDate = CDate(TextBox3.Text)
If (TextBox4.Text = Format(tDate, "dddd") = "Monday") Then
TextBox3.Value = Format(TextBox3.Value, "dd/mm/yyyy") + 6
End If
End If
End Sub