PDA

View Full Version : [SOLVED:] Multiply Values in a Textbox



Zephid15
02-20-2007, 01:42 PM
i have a quantity box and a price box and naturally a total. how do i multiply the first two boxes to put the price in the third.

this is what i have so far and its not working

TextBox1e = TextBox1a.Value * TextBoxq1.Value

mdmackillop
02-20-2007, 04:52 PM
This works for me

Private Sub UserForm_Initialize()
TextBox1.Value = 3
TextBox2.Value = 2
TextBox3.Value = TextBox1.Value * TextBox2.Value
End Sub

Zephid15
02-21-2007, 09:48 AM
thats only works once. i want to change one of the numbers and have the total update.

lucas
02-21-2007, 10:00 AM
use textbox change or update

Zephid15
02-21-2007, 10:12 AM
I had the Change but its not working.

Sub txtq1_Change()
txt1e = txt1q.Value * txt1d.Value
End Sub

mdmackillop
02-21-2007, 11:02 AM
Private Sub TextBox1_AfterUpdate()
DoUpdate
End Sub

Private Sub TextBox2_AfterUpdate()
DoUpdate
End Sub

Sub DoUpdate()
If TextBox1.Value = "" Then TextBox1.Value = 0
If TextBox2.Value = "" Then TextBox2.Value = 0
TextBox3.Value = TextBox1.Value * TextBox2.Value
End Sub