+ Reply to Thread
Results 1 to 4 of 4

Find time difference

  1. #1
    Forum Contributor
    Join Date
    02-20-2009
    Location
    bristol
    MS-Off Ver
    Excel 2003
    Posts
    882

    Find time difference

    Hi folks

    I want to find the time difference using vba. when the form is intialized then the starttime gets stored in textbox1 as follows:

    textbox1.value=format(now,"hh:mm:ss")

    The finish time is calculated when the enter button is clicked and is stored in variable t as follows:
    Please Login or Register  to view this content.
    Now I am writing the following line of code to find time diff but it gives me type mismatch error:

    Please Login or Register  to view this content.

    Can anyone please figure it out.

    Thanks
    Aman

  2. #2
    Forum Expert
    Join Date
    11-23-2005
    Location
    Rome
    MS-Off Ver
    Ms Office 2016
    Posts
    1,628

    Re: Find time difference

    Try to put this code at form initialization:
    Please Login or Register  to view this content.
    then use this code at enter button click:
    Please Login or Register  to view this content.
    and then to calculate difference you can use:
    Please Login or Register  to view this content.
    Regards,
    Antonio

  3. #3
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Find time difference

    Look at datediff (VBEditor, F1)

  4. #4
    Forum Contributor
    Join Date
    02-20-2009
    Location
    bristol
    MS-Off Ver
    Excel 2003
    Posts
    882

    Re: Find time difference

    Thanks a lot Antonio. It works absolutely fine.

+ 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