+ Reply to Thread
Results 1 to 3 of 3

Automatically multiplying totals on a userform

  1. #1
    Greg B
    Guest

    Automatically multiplying totals on a userform

    Hi all
    I need to be able to have a userform automatically multiply the totals of
    textbox 2 by textbox 7 and display it in textbox 10.

    How do I do this?

    Thanks

    Greg



  2. #2
    K Dales
    Guest

    RE: Automatically multiplying totals on a userform

    In the UserForm's code module, put the following:

    Private Sub TextBox2_Change()

    TextBox10 = Val(TextBox2) * Val(TextBox7)

    End Sub

    Private Sub TextBox7_Change()

    TextBox10 = Val(TextBox2) * Val(TextBox7)

    End Sub

    "Greg B" wrote:

    > Hi all
    > I need to be able to have a userform automatically multiply the totals of
    > textbox 2 by textbox 7 and display it in textbox 10.
    >
    > How do I do this?
    >
    > Thanks
    >
    > Greg
    >
    >
    >


  3. #3
    Forum Contributor
    Join Date
    01-21-2005
    Location
    Colorado
    MS-Off Ver
    2000,2003,2007
    Posts
    481
    Greg,

    Give this code a try.

    Private Sub TextBox2_Change()
    If TextBox2 = "" Then TextBox2 = 0
    If TextBox7 = "" Then TextBox7 = 0
    TextBox10.Value = TextBox2 * TextBox7
    End Sub

    Private Sub TextBox7_Change()
    If TextBox2 = "" Then TextBox2 = 0
    If TextBox7 = "" Then TextBox7 = 0
    TextBox10.Value = TextBox2 * TextBox7
    End Sub

    You may want to add some error handlers if the user tries to enter non numeric values into either text box. You may also want to disable textbox10 so they cannot change the value of textbox10 simply by typing directly in the textbox.

    HTH

+ 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