+ Reply to Thread
Results 1 to 5 of 5

need to convert time to minutes in userform

  1. #1
    Forum Contributor
    Join Date
    08-08-2006
    Posts
    203

    need to convert time to minutes in userform

    I know how to do this in a worksheet:

    =(b1-a1)*1440

    B1 being the end time and A1 being the start time

    I have a userform where the start time and end time are entered in text boxes

    txtstart1 and txtend1

    I would like the result to show up in txtmin1

    Here is my code that doesnt work. I tried to convert code from a non-time sheet of mine. Dim as Integer may be the problem, I just learn as I go, and so far have only dealt with Integers.

    Please Login or Register  to view this content.
    Thank you for any help
    Last edited by iturnrocks; 07-14-2009 at 01:59 PM.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: need to convert time to minutes in userform

    You're missing some parens in the calculation.

    What is the format of the data in the textboxes?
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Contributor
    Join Date
    08-08-2006
    Posts
    203

    Re: need to convert time to minutes in userform

    time will be entered in the text boxes as (txtstart1) 11:00 (txtend1) 14:00

    txtmin1 should then equal 180

    ah yes, the parenthesis in the calculation. I havent got that far, I get an error telling me that 11:00 makes a lousy integer.

    Heres the actual error I get when I run it

    Run-time error '13':

    and when I debug, this is highlighted

    endnum1 = txtend1.Value
    Last edited by iturnrocks; 07-14-2009 at 01:51 PM.

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: need to convert time to minutes in userform

    That too.

    I can't test this at all without making a form, so ...
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    08-08-2006
    Posts
    203

    Re: need to convert time to minutes in userform

    That works great, thank you very much.

+ 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