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

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
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,213,482
Messages
6,113,916
Members
448,533
Latest member
thietbibeboiwasaco

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