+ Reply to Thread
Results 1 to 9 of 9

Add the time value of two comboboxes

  1. #1
    Registered User
    Join Date
    11-24-2012
    Location
    Stratford-upon-Avon
    MS-Off Ver
    Excel 2007
    Posts
    89

    Add the time value of two comboboxes

    Userform has a ComboBox called StartTime and allows the user to select a time for example, 08:04. The TextBox called Mins shows a value of 00:08 which has been added from Text Box Properties, Text. I want to add StartTime to Mins and show result in EndTime ie. 08:12. I have put this code in both the StartTime and Mins Private Sub but only get a value of 00:00 in EndTime

    Please Login or Register  to view this content.

    Please Login or Register  to view this content.
    Thanks

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Add the time value of two comboboxes

    Try this.
    Please Login or Register  to view this content.
    Oh, and put the code in the Exit event of Mins.
    Last edited by Norie; 12-12-2013 at 01:45 PM.
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    11-24-2012
    Location
    Stratford-upon-Avon
    MS-Off Ver
    Excel 2007
    Posts
    89

    Re: Add the time value of two comboboxes

    Sorry Norie I changed the code, ran it, but debug came back to the code.

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Add the time value of two comboboxes

    Where did you put the code?

    You shouldn't put it in the change event, that's triggered every time you type in the textbox.

  5. #5
    Registered User
    Join Date
    11-24-2012
    Location
    Stratford-upon-Avon
    MS-Off Ver
    Excel 2007
    Posts
    89

    Re: Add the time value of two comboboxes

    Norrie could you tell me how to use the 'Exit' event please

  6. #6
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Add the time value of two comboboxes

    Here's the exit event for Mins.
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    11-24-2012
    Location
    Stratford-upon-Avon
    MS-Off Ver
    Excel 2007
    Posts
    89

    Re: Add the time value of two comboboxes

    I have added the Exit Sub and removed the code from the Mins_Change() Sub. But it debugs to the StartTime code I have added

  8. #8
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Add the time value of two comboboxes

    Can you upload an example workbook?

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

  9. #9
    Registered User
    Join Date
    11-24-2012
    Location
    Stratford-upon-Avon
    MS-Off Ver
    Excel 2007
    Posts
    89

    Re: Add the time value of two comboboxes

    Sorry for the delay Norie. I have attached my workbook. It is easier to tell you exactly what I am trying to achieve as you may think that there is a simlper solution. I am trying to get an EndTime value to populate the EndTime Text Box based upon enties in PlayingIn, LastYear, StartTime and Times Allocated, StartTime and Mins.

    EndTime = TimesAllocated x 8minutes +StartTime + 8 minutes

    (This is how I get the correct value using a formula in the spreadsheet that is populated by the form).
    Attached Files Attached Files

+ 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. Comboboxes example
    By cv24 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-02-2012, 08:49 PM
  2. [SOLVED] Calculating Time in Userform Textbox and Filtering Comboboxes Coding Help
    By hiddenupnorth in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-01-2012, 01:12 PM
  3. Add comboboxes on userform at run time
    By c.vaibhav in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-08-2009, 03:35 AM
  4. [SOLVED] OLE comboboxes
    By Mikkan in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-22-2005, 08:05 PM
  5. comboboxes
    By lgbjr in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 06-01-2005, 02:05 AM

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