ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Date increments by X number of days (https://www.excelbanter.com/excel-programming/347686-date-increments-x-number-days.html)

sweens319

Date increments by X number of days
 
I don't really know much about VBA, but I'm learning. Trying to teach myself.
Thank you to all who have posted questions and answers enabling me to advance
my skills. My questions are about dates.

If I create a variable like this:
'this could be wrong, like I said I don't know much
dim LastCall as Date
dim NextCall as Date

Now, I want to read in a date in MM/D(D)/YYYY format to LastCall and make
NextCall equal to LastCall + 5 days.
How do I do this without writing a huge if then statement? (if the month =
this or this for 30 days then if the current date is 26 or greater .....else
if month = this or this for 31 days then if the current date is 27 or
greater...change month...)

Also, how do I access the system date? I want to then compare the NextCall
date to system date (current date) and then I'll be creating a task in
Outlook if current date is = NextCall. I suppose it would be easier to just
compare the system date to LastCall and figure out if it is 5 days or more,
so if you can suggest how to do that, it would be appreciated as well.

Bob Phillips[_6_]

Date increments by X number of days
 
Nextcall = Lastcall + 5

sysDate = Date

If Date = NextCall Then
...

or

If Date = LastCall + 5 Then
...

--

HTH

RP
(remove nothere from the email address if mailing direct)


"sweens319" wrote in message
...
I don't really know much about VBA, but I'm learning. Trying to teach

myself.
Thank you to all who have posted questions and answers enabling me to

advance
my skills. My questions are about dates.

If I create a variable like this:
'this could be wrong, like I said I don't know much
dim LastCall as Date
dim NextCall as Date

Now, I want to read in a date in MM/D(D)/YYYY format to LastCall and make
NextCall equal to LastCall + 5 days.
How do I do this without writing a huge if then statement? (if the month =
this or this for 30 days then if the current date is 26 or greater

......else
if month = this or this for 31 days then if the current date is 27 or
greater...change month...)

Also, how do I access the system date? I want to then compare the

NextCall
date to system date (current date) and then I'll be creating a task in
Outlook if current date is = NextCall. I suppose it would be easier to

just
compare the system date to LastCall and figure out if it is 5 days or

more,
so if you can suggest how to do that, it would be appreciated as well.





All times are GMT +1. The time now is 03:56 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com