IainClover
New Member
- Joined
- Dec 1, 2020
- Messages
- 11
- Office Version
- 2013
- Platform
- Windows
I have a userform, where most of my coding is sorted, I now have the issue of a review date
I have two Textboxes
“TxDate1” is the date a decision is made
“TxDate2” is the date the decision is reviewed
Both textboxes are formatted as per UK date values as below
There is a combo box “CbReview” in the userform that has a preselected set of values, that dictates the period of time between “Decision” and “Review Date” If the period “2 Weeks” is selected from the drop down list then it is a simple formula, that I have no issues with
My question is how do I add a calendar month, if “1 Month” is selected or 3 calendar months if “3 Months” is selected.
I can enter the date manually into “TxDate2”, but wondered if there was a formula, that would sort this out.
Thanks in advance
Iain C
I have two Textboxes
“TxDate1” is the date a decision is made
“TxDate2” is the date the decision is reviewed
Both textboxes are formatted as per UK date values as below
VBA Code:
Private Sub TxDate1_AfterUpdate()
Dim dDate As Date
dDate = DateSerial(Year(Date), Month(Date), Day(Date))
TxDate1.Value = Format(TxDate1.Value, "d mmm yy")
On Error GoTo 0
End Sub
Private Sub TxDate2_AfterUpdate()
Dim dDate As Date
dDate = DateSerial(Year(Date), Month(Date), Day(Date))
TxDate2.Value = Format(TxDate2.Value, "d mmm yy")
On Error GoTo 0
End Sub"
There is a combo box “CbReview” in the userform that has a preselected set of values, that dictates the period of time between “Decision” and “Review Date” If the period “2 Weeks” is selected from the drop down list then it is a simple formula, that I have no issues with
Code:
If CbReview.value = “2 weeks” then
TxDate2.Value = TxDate1.Value + 14
End If
My question is how do I add a calendar month, if “1 Month” is selected or 3 calendar months if “3 Months” is selected.
I can enter the date manually into “TxDate2”, but wondered if there was a formula, that would sort this out.
Thanks in advance
Iain C