Results 1 to 6 of 6

Adding 15 minutes to a time variable in VBA

This is a discussion on Adding 15 minutes to a time variable in VBA within the Excel Questions forums, part of the Question Forums category; Hi, another one that is giving me a headache. I am settting two values for DTPickers, one with DTPicker1.value = ...

  1. #1
    Board Regular
    Join Date
    May 2002
    Location
    Auckland
    Posts
    413

    Default Adding 15 minutes to a time variable in VBA

    Hi, another one that is giving me a headache.

    I am settting two values for DTPickers, one with DTPicker1.value = Format(now(), "hh:mm") as the value the other to be DTPicker.value = Format(DTPicker1.value + 15, "hh:mm") but I am getting no where fast.

    The answer is probably so simple, but I just cant see it for the life of me...

    Help!!! please

  2. #2
    Board Regular
    Join Date
    Jan 2006
    Location
    Phillipines
    Posts
    1,624

    Default

    try;

    Code:
    DTPicker.value = Format(DTPicker1.value + timevalue("00:15"), "hh:mm")

  3. #3
    Board Regular
    Join Date
    May 2002
    Location
    Auckland
    Posts
    413

    Default

    Hi agihcam,
    the returned value is the same as the TimeValue = "00:15" so it did not actually add the 15 to the time already set.


    Thanks for the assistance.

  4. #4
    Board Regular
    Join Date
    Jan 2006
    Location
    Phillipines
    Posts
    1,624

    Default

    it works with mine.

  5. #5
    MrExcel MVP
    Moderator
    Scott Huish's Avatar
    Join Date
    Mar 2004
    Location
    Oregon
    Posts
    17,055

    Default

    Try this:

    Code:
    DTPicker = Format(TimeValue(DTPicker1) + TimeValue("00:15"), "hh:mm")
    Office 2007/2010

  6. #6
    Board Regular
    Join Date
    May 2002
    Location
    Auckland
    Posts
    413

    Default

    Sorted, thanks Guys!

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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


DMCA.com