+ Reply to Thread
Results 1 to 6 of 6

Calculating Time in Userform Textbox and Filtering Comboboxes Coding Help

Hybrid View

  1. #1
    Registered User
    Join Date
    03-28-2012
    Location
    Minnesota, USA
    MS-Off Ver
    Excel 2007
    Posts
    12

    Question Calculating Time in Userform Textbox and Filtering Comboboxes Coding Help

    Hello, somehow I need to get my Start / Finish textboxes to total in my Hours textbox, then I do need it to show a total hours for the day. Also, I need to filter my Account Description combobox based on my Account Code combobox. I have attached the file so that you can understand my question better, any help is much appreciated! Thanks
    Attached Files Attached Files
    Last edited by hiddenupnorth; 04-24-2012 at 11:23 AM. Reason: To be more clear in title

  2. #2
    Registered User
    Join Date
    03-28-2012
    Location
    Minnesota, USA
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Calculating Time in Userform Textbox and Filtering Comboboxes Coding Help ~ Please

    Is this something that is even possible?

  3. #3
    Forum Expert Whizbang's Avatar
    Join Date
    08-05-2009
    Location
    Greenville, NH
    MS-Off Ver
    2010
    Posts
    1,395

    Re: Calculating Time in Userform Textbox and Filtering Comboboxes Coding Help ~ Please

    You would need to add code into each start/finish textbox to update the values in the Hours/TotalHours textboxes. Forms in Excel do not do auto-calculate. You need to tell it to do that.

    As for Account Description, you would need to have the Account Code update event(s) regenerate the rowsource. You probably need to set the rowsource to "" and then give it the appropriate rowsource. I am not 100% sure on this because I am going from memory and I haven't had to work with combo boxes in Excel in a while.

  4. #4
    Registered User
    Join Date
    03-28-2012
    Location
    Minnesota, USA
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Calculating Time in Userform Textbox and Filtering Comboboxes Coding Help

    I have been trying to create a code, but I am not sure because it is not working to calculate the hours. I am so new to VBA and userforms, so my codes probably make a seasoned coding guru cringe, lol. Is that code going to be in the textbox private sub or the part where everything is?
    You are speaking complete gibberish to me, it is as clear as mud talking about the Account Code

  5. #5
    Forum Expert Whizbang's Avatar
    Join Date
    08-05-2009
    Location
    Greenville, NH
    MS-Off Ver
    2010
    Posts
    1,395

    Re: Calculating Time in Userform Textbox and Filtering Comboboxes Coding Help

    Please take the time to read through some VBA tutorials. Here is a short list that you might find helpful.

    http://www.excel-vba.com/excel-vba-s...-beginners.htm
    http://www.fontstuff.com/ebooks/free/fsUserForms.pdf
    http://www.exceltip.com/st/Create_Us...Excel/629.html
    http://www.xtremevbtalk.com/showthre...hreadid=131000


    Essentially, every object on the form has some sort of "events" that you can add code to to get things done. The most used event is the "Click" event. The user clicks on a button and your code runs. But other events include things like "Change" and "Update" and "Activate", etc. The event you are interested in here is the Update event. For each of the start/finish textbox controls you have, you need to add code to the Update event to calculate the value for the appropriate Hours textbox.

  6. #6
    Registered User
    Join Date
    03-28-2012
    Location
    Minnesota, USA
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Calculating Time in Userform Textbox and Filtering Comboboxes Coding Help

    Thank you, that is what I needed, was to know what type of event I was needing to use. Much appreciated I will move on from here

+ 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