+ Reply to Thread
Results 1 to 2 of 2

Time calculation formula to VBA

  1. #1
    Forum Contributor
    Join Date
    05-12-2009
    Location
    Hendersonville, TN
    MS-Off Ver
    Excel 2010
    Posts
    113

    Time calculation formula to VBA

    Hi All,

    I have a worksheet that I am changing over to a Userform. On my worksheet is a time calculation formula. =Round(Mod(B31-B30,1)*24,0)/24 I would like to derive the same calculation through some VBA code but have been failing. On the userform, "tbstart" textbox is analogous to B30 on the old worksheet. "tbend" textbox is analogous to B31. "tbtotal" is my target textbox for the calculation. The time calculations occasionally go past midnight. I am just looking for total hours, rounded to the nearest hour.


    Thank you,

    Patrick

  2. #2
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: Time calculation formula to VBA

    What is

    MOD(B31-B30,1)

    supposed to produce?

    MOD(x,1)

    seems to produce 0 regardless of the value of x, making B31-B30 redundant.

    Thoughts?
    Last edited by Special-K; 11-17-2016 at 11:31 AM.
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Over time calculation formula
    By Nawwy in forum Excel General
    Replies: 3
    Last Post: 08-02-2014, 03:27 PM
  2. [SOLVED] VB vs Formula - Calculation time
    By pytheus in forum Excel General
    Replies: 2
    Last Post: 06-26-2014, 04:19 AM
  3. Time calculation formula
    By mahesh8498 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-25-2012, 05:14 AM
  4. Help with time calculation formula
    By MZing81 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-23-2012, 01:20 PM
  5. Excel 2007 : Formula help... Time calculation
    By artsim84 in forum Excel General
    Replies: 2
    Last Post: 10-21-2011, 01:18 PM
  6. Time Calculation Formula
    By smartcard in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-26-2011, 09:59 AM
  7. Time Calculation Formula!
    By Mike in forum Excel General
    Replies: 5
    Last Post: 07-23-2005, 12:05 AM

Tags for this Thread

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