+ Reply to Thread
Results 1 to 2 of 2

Date increments by X number of days

  1. #1
    sweens319
    Guest

    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.

  2. #2
    Bob Phillips
    Guest

    Re: 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" <[email protected]> wrote in message
    news:[email protected]...
    > 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.




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1