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
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
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
>
>
>
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
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks