+ Reply to Thread
Results 1 to 8 of 8

Userform with calculated fields

  1. #1
    Forum Contributor Portuga's Avatar
    Join Date
    02-20-2004
    Location
    Portugal
    MS-Off Ver
    365
    Posts
    852

    Userform with calculated fields

    Hi people.

    I have some experience with VBA, but am new to userforms and am trying to get in the right direction on something.
    Please see attached excel sheet.

    There is a simple table with fields that are inserted manually and others that are calculated.
    I would like to have that table converted into a userform where the user would input the values and the calculations would be automatic.

    The cells in green are the manual/variable values.
    The others are the results I want.

    I created a userform in VBA and inserted it in the file as a jpg so you can see what I am looking for.

    1 example of the code for 1 calculated field and how I need to do it would be awesome

    Thanks in advance
    Attached Files Attached Files
    If you found the solution to your question. Mark the thread as "Solved"
    Thank everyone that helped you with a valid solution by clicking on their

    There is no such thing as a problem, only a temporary lack of a solution

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

    Re: Userform with calculated fields

    What calculations do you want to do?

    What textboxes contain the values involved in the calculations?

    When do you want calculation to happen?
    If posting code please use code tags, see here.

  3. #3
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,659

    Re: Userform with calculated fields

    Why didn't you include the userform in the example workbook?

    If you do web search for something like Excel vba userform tutorial calculations, you will find several step-by-step guides and videos with examples.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  4. #4
    Forum Contributor Portuga's Avatar
    Join Date
    02-20-2004
    Location
    Portugal
    MS-Off Ver
    365
    Posts
    852

    Re: Userform with calculated fields

    Thanks for the help.

    @ Norie - the manual values are in cells G2,G3,G6,G7,G9. The cells in green.

    The others are the calculations I need and are on the remaining cells of column G.

    I want the calculations to occur when all whe values in G2,G3,G6,G7,G9 are inserted manually in the corresponding textboxes
    (I just realized that the textbox for price per hour/Machine is missing, so that would have to be added to the userform.

    Edit: The calculations could also occur when I click a command button.
    Last edited by Portuga; 04-26-2014 at 03:31 PM.

  5. #5
    Forum Contributor Portuga's Avatar
    Join Date
    02-20-2004
    Location
    Portugal
    MS-Off Ver
    365
    Posts
    852

    Re: Userform with calculated fields

    I´m inserting the sheet with the userform as suggested with what I have done so far.
    Hopefully this will be more clear show what I am looking for.

    So right now, I have on cell H5 the calculated Value of 222,2 through a simple devision by another value found through a Vlookup.

    If you open the userform

    By inserting the values "200" in the textbox1 "perímetro"
    By inserting the Values "50" in the textbox2 "Espessura"
    And then click on the "calculate" Button, I want the result 222,2 to be displayed in Textbox4 - "Tempo de corte"

    I need more calculations but if I could get this one on the right track I could then make my way through to finish the rest of them.
    I am having trouble finding the propper way to write this.

    Thanks
    Attached Files Attached Files

  6. #6
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,659

    Re: Userform with calculated fields

    Try this...

    Please Login or Register  to view this content.
    Keep in mind a textbox is not like a cell. Textboxes contain Text even when it is numeric text. Which means you may have to convert the numeric-text to a number when the code reads the textbox, or format a number as text when it writes a number to the textbox.

  7. #7
    Forum Contributor Portuga's Avatar
    Join Date
    02-20-2004
    Location
    Portugal
    MS-Off Ver
    365
    Posts
    852

    Re: Userform with calculated fields

    Thanks AlphaFrog that´s awesome! Works like a charm.

    Now I´ll try to make sense of the code and incorporate the remaining calculations.

    Thanks for the help.

  8. #8
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,659

    Re: Userform with calculated fields

    You're welcome.

+ 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. Calculated fields
    By DAVEG01 in forum Excel Charting & Pivots
    Replies: 13
    Last Post: 03-15-2013, 10:32 AM
  2. HELP Reg Calculated Fields
    By sunvin in forum Excel General
    Replies: 8
    Last Post: 07-09-2008, 01:45 PM
  3. Calculated Fields Based on Running Total Fields?
    By Kruncher in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-12-2006, 01:25 PM
  4. Calculated fields
    By nc in forum Excel General
    Replies: 0
    Last Post: 05-09-2006, 09:50 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