Add Calendar Months to a Date Box

IainClover

New Member
Joined
Dec 1, 2020
Messages
11
Office Version
  1. 2013
Platform
  1. 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

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
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Thank you the following code worked, ...... I will find this a useful function in the future

VBA Code:
If CbReview.Value = "3 Months" Then
TxDate2.Value = DateAdd("m", 3, TxDate1.Value)
End If

Your assistance is much appreciated
Iain C
 
Upvote 0

Forum statistics

Threads
1,223,948
Messages
6,175,580
Members
452,653
Latest member
craigje92

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