+ Reply to Thread
Results 1 to 11 of 11

Userform with Time Field displays Time as Number

  1. #1
    Forum Contributor
    Join Date
    07-24-2008
    Location
    San Antonio, Texas
    Posts
    118

    Userform with Time Field displays Time as Number

    I have a userform that has a time field on it and then the userform displays the time as a number.

    Ex. I entered 11:00 AM in the Time of Contact field and the form displays it as 0.458333333333333.

    Below is the code that I currently have.

    Please Login or Register  to view this content.
    I am not sure how to change the code to reflect the time instead of a number. I am thinking that it needs to be formated somehow.
    Last edited by randolphoralph; 12-29-2008 at 10:19 AM.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello randolphoralph,

    There two ways to solve this. If the cell is already formatted to display the time, load the text box with cell's Text property. The other way is to explicitly use a format statement. Here are the examples...
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

  3. #3
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Your post does not comply with Rule 8 of our Forum RULES. Cross-posting is when you post the same question in other forums on the web. You'll find people are disinclined to respond to cross-posts because they may be wasting their time solving a problem that has been solved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the url from the address bar in your browser)to the cross-post. Expect cross-posts without a link to be closed a message will be posted by the moderator explaining why. We are here to help so help us help you!
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  4. #4
    Forum Contributor
    Join Date
    07-24-2008
    Location
    San Antonio, Texas
    Posts
    118
    I have not posted this issue anywhere else. Please provide more info. Thanks

  5. #5
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845
    Hi,

    I think this is thread at issue

    http://www.mrexcel.com/forum/showthread.php?t=360979
    Charles

    There are other ways to do this, this is but 1 !
    Be Sure you thank those who helped.
    IF YOU'RE SATISFIED BY ANY MEMBERS RESPONSE TO YOUR ISSUE PLEASE USE THE STAR ICON AT THE BOTTOM LEFT OF THE POST UNDER THEIR NAME.

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    In fairness, the code was the same, but the question was different.

    RoyUK has a date-picker add-in that avoids the need for other people to install calendar control:
    http://www.excel-it.com/free_addins.htm
    Last edited by shg; 12-26-2008 at 03:38 PM.
    Entia non sunt multiplicanda sine necessitate

  7. #7
    Forum Contributor
    Join Date
    07-24-2008
    Location
    San Antonio, Texas
    Posts
    118
    Leith,

    Thank you! It worked perfect.



    Charles and VBA Noob,

    That posting is referring to using the Date & Time Picker for the DateofContact field on a Userform.

    This current posting is referring to using a textbox for the Time Field.

    I do realize they are very similar. I found out that the users would not have the Date & Time Picker so I would have to go with Text Box unless I could write the Date and Time Picker into code.

    Sorry about any confusion that this may have caused.

    If this is really cross posting please let me know and I will not post anything similar anywhere else.

    shg,

    Thank you. I will look at that add in. Do you know if after I create the file will the users need to install the add-in? I am not sure how to use this on the userform or how to write the code for it?

    If it works should I post the solution on the other link or what do I do? I do not want to make a mess of this.

    I am sorry that I am a pain I am a noob to programming and trying to learn as quick as I can.
    Last edited by randolphoralph; 12-26-2008 at 04:20 PM.

  8. #8
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    Do you know if after I create the file will the users need to install the add-in? I
    Yes, other users would need to install it. Had Roy provided the source, you could have copied the form and code to your workbook, but the project is protected.

    You might Googleexcel date picker; I'm sure someone has posted an open-source version.

  9. #9
    Forum Contributor
    Join Date
    07-24-2008
    Location
    San Antonio, Texas
    Posts
    118
    Yea I checked for open source date pickers and had no luck but it was worth a shot.

  10. #10
    Forum Contributor
    Join Date
    07-24-2008
    Location
    San Antonio, Texas
    Posts
    118
    If anyone runs across one that is open source please let me know. Thanks

  11. #11
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    There's a calendar form to use in your projects here

    The code in the addin is protected because it represents hours of work & I use it in many of my projects.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

+ 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