Results 1 to 2 of 2
  1. #1
    2 Star Lounger
    Join Date
    Feb 2008
    Location
    LOUISVILLE, Kentucky, USA
    Posts
    106
    Thanks
    0
    Thanked 0 Times in 0 Posts

    subtracting time in cells (vb)

    question

    without using any excel code or formula's (strictly visual basic), how would i subtract cell c4 from cell d4 to give me the amount of minutes that elapsed.

    cell c4 = 10:00 am
    cell d4 = 10:04 am
    cell f4 = 00:04 minutes

    cell f99 = total minutes elapsed from column f

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: subtracting time in cells (vb)

    Range("F99") = (Range("D4") - Range("C4")) * 24 * 60

    Times are stored as fractions of 1 day, so to convert a time to minutes, you multiply it with 24 (hours per day) and with 60 (minutes per hour).

    Or:

    Range("F99") = DateDiff("n", Range("C4"), Range("D4"))

Posting Permissions

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