I have a userform in which the user completes a text box with a start date. And my userform adds one month, i have only just noticed that this can be an issue in Jan and Feb due to the number of days.
Our payments months are e.g. 12/01/2017 - 11/02/2017
12/02/2017 - 11/02/2017
However our clients can sometimes have start dates of the 30/1/17 & 31/1/17 which gives me a problem as our end dates need to be like this 28/1/17-27/2/17, 30/1/17-27/2/17, 31/1/17 - 28/2/17.
I have not got the foggiest how to approach this.
My code so far that i was using was
The user is normally dealing with one month however there are instances where it can be more so date could be changed manually to 30/1/17-29/3/17 etc these dates feed into a calculator which auto loads the dates between until the end date is met.
Can anyone help? I considered hard coding exceptions but i doubt that would be the most efficient as this will happen every year.
Our payments months are e.g. 12/01/2017 - 11/02/2017
12/02/2017 - 11/02/2017
However our clients can sometimes have start dates of the 30/1/17 & 31/1/17 which gives me a problem as our end dates need to be like this 28/1/17-27/2/17, 30/1/17-27/2/17, 31/1/17 - 28/2/17.
I have not got the foggiest how to approach this.
My code so far that i was using was
Code:
Main.opEndDate.Value = Format((DateAdd("m", 1, opStartDate.Value) - 1), "dd/mm/yyyy")
The user is normally dealing with one month however there are instances where it can be more so date could be changed manually to 30/1/17-29/3/17 etc these dates feed into a calculator which auto loads the dates between until the end date is met.
Can anyone help? I considered hard coding exceptions but i doubt that would be the most efficient as this will happen every year.