+ Reply to Thread
Results 1 to 18 of 18

Not showing value time in TextBox and ListBox

  1. #1
    Registered User
    Join Date
    08-12-2013
    Location
    Weesp, Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    13

    Not showing value time in TextBox and ListBox

    To anyone, please help

    I have an UserForm with TekstBox2 to fill in Time (mm:ss). It writes the entries to the sheet nicely. But when I look for a special record in de ListBox, time shows as Numberformat 0,5441 instead of mm:ss.
    When I select a record out of the listbox, the TextBox2 showes that numberformat instead mm:ss.

    Can anybody help me with a Code to show the right format in de ListBox and TextBox?

  2. #2
    Valued Forum Contributor xlbiznes's Avatar
    Join Date
    02-22-2013
    Location
    Bahrain
    MS-Off Ver
    Excel 2007
    Posts
    1,223

    Re: Not showing value time in TextBox and ListBox

    Hi,

    Before you add the data to you list box convert it using the format function and then take the last 5 characters from the right
    Please Login or Register  to view this content.
    replace now() with the cell range.
    Happy Computing ,

    Xlbiznes.

    To show your appreciation please click *

  3. #3
    Registered User
    Join Date
    08-12-2013
    Location
    Weesp, Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Not showing value time in TextBox and ListBox

    Sorry

    I don't understand. The next code I have for wrighting to the ListBox:

    With Me 'load entry to form
    .ComboBox2.Value = c.Offset(0, 0).Value
    .ComboBox4.Value = c.Offset(0, 1).Value
    .TextBox2.Value = c.Offset(0, 2).Value
    .TextBox4.Value = c.Offset(0, 3).Value
    .TextBox3.Value = c.Offset(0, 4).Value
    .ComboBox5.Value = c.Offset(0, 5).Value
    .ComboBox3.Value = c.Offset(0, 6).Value
    .TextBox8.Value = c.Offset(0, 7).Value
    .TextBox5.Value = c.Offset(0, 8).Value
    .TextBox6.Value = c.Offset(0, 9).Value
    .TextBox9.Value = c.Offset(0, 10).Value
    .TextBox10.Value = c.Offset(0, 11).Value

    TextBox3 and TextBox10 are the timefields. Where do I write your code?

    regards

  4. #4
    Valued Forum Contributor xlbiznes's Avatar
    Join Date
    02-22-2013
    Location
    Bahrain
    MS-Off Ver
    Excel 2007
    Posts
    1,223

    Re: Not showing value time in TextBox and ListBox

    Like this :

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    08-12-2013
    Location
    Weesp, Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Not showing value time in TextBox and ListBox

    I Tried, is still not working.
    Sorry

  6. #6
    Valued Forum Contributor xlbiznes's Avatar
    Join Date
    02-22-2013
    Location
    Bahrain
    MS-Off Ver
    Excel 2007
    Posts
    1,223

    Re: Not showing value time in TextBox and ListBox

    Can you post a sample workbook , so that we can work directly on your requirement.

  7. #7
    Registered User
    Join Date
    08-12-2013
    Location
    Weesp, Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Not showing value time in TextBox and ListBox

    I am at work now. I have tot uploap from home. So it take a time, sorry

  8. #8
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643
    Instead of Value use Text, then you'll get the value as it's formatted.
    If posting code please use code tags, see here.

  9. #9
    Registered User
    Join Date
    08-12-2013
    Location
    Weesp, Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Not showing value time in TextBox and ListBox


  10. #10
    Valued Forum Contributor xlbiznes's Avatar
    Join Date
    02-22-2013
    Location
    Bahrain
    MS-Off Ver
    Excel 2007
    Posts
    1,223

    Re: Not showing value time in TextBox and ListBox

    Hi,

    texbox4 and textbox10 are the time fields and not textbox3 as stated by you. Attached is your sheet with the changes made to textbox3 and textbox10.
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    08-12-2013
    Location
    Weesp, Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Not showing value time in TextBox and ListBox

    Hi

    Thanks for your effort sofar. Still the Userform not showes the time.

    regards

  12. #12
    Registered User
    Join Date
    08-12-2013
    Location
    Weesp, Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Not showing value time in TextBox and ListBox

    Hi

    I am a beginner with VBA. In the Userform (and listbox) I see the time as a number instead time notation. In the sheet is all ok. Time stays time.

    with regards

  13. #13
    Valued Forum Contributor xlbiznes's Avatar
    Join Date
    02-22-2013
    Location
    Bahrain
    MS-Off Ver
    Excel 2007
    Posts
    1,223

    Re: Not showing value time in TextBox and ListBox

    The problem is that your listbox in the file that you have send does not show anything. If you could also direct me the what to click in the form as it is in dutch language.

  14. #14
    Registered User
    Join Date
    08-12-2013
    Location
    Weesp, Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Not showing value time in TextBox and ListBox

    Hi

    I have changed the dutch names into englisch names. When you go to find object and choose in the comboBox for Test1 and presse the OK button then the ListBox shows you 4 records.In collumn Time1 you see a nummer instead a time. In the sheet1 is the correct time.
    When you select a row, in the TextBox "Time1" filled in a number instead time.

    How can I show in the ListBox and in the TextBox "Time1" the correct value?

    best regards
    Attached Files Attached Files

  15. #15
    Registered User
    Join Date
    08-12-2013
    Location
    Weesp, Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Not showing value time in TextBox and ListBox

    Sorry

    I added the wrong xlsm
    Attached Files Attached Files

  16. #16
    Valued Forum Contributor xlbiznes's Avatar
    Join Date
    02-22-2013
    Location
    Bahrain
    MS-Off Ver
    Excel 2007
    Posts
    1,223

    Re: Not showing value time in TextBox and ListBox

    Hi,

    try this one, with the changes made to get the desired result.
    Attached Files Attached Files

  17. #17
    Registered User
    Join Date
    08-12-2013
    Location
    Weesp, Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Not showing value time in TextBox and ListBox

    Thank you very muth. Its working!

  18. #18
    Valued Forum Contributor xlbiznes's Avatar
    Join Date
    02-22-2013
    Location
    Bahrain
    MS-Off Ver
    Excel 2007
    Posts
    1,223

    Re: Not showing value time in TextBox and ListBox

    You are welcome.

    If you are satisfied with the solution provided, please mark this thread as solved.

+ 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. [SOLVED] listbox on userform not showing specific cells
    By cfinch100 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-23-2013, 12:29 PM
  2. Listbox is showing data from outside the range set?
    By Smurlos in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-21-2010, 08:41 AM
  3. showing cell value in textbox
    By surfinglaverty in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-21-2010, 10:02 AM
  4. Preventing ListBox from showing blank cells
    By Carlsbergen in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 09-29-2009, 01:58 AM
  5. Showing a calculation in a userform Textbox
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-03-2006, 08:35 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