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
[vba]TextBox1e = TextBox1a.Value * TextBoxq1.Value[/vba]
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
[vba]TextBox1e = TextBox1a.Value * TextBoxq1.Value[/vba]
This works for me
Private Sub UserForm_Initialize() TextBox1.Value = 3 TextBox2.Value = 2 TextBox3.Value = TextBox1.Value * TextBox2.Value End Sub
Last edited by Aussiebear; 04-12-2023 at 06:25 PM. Reason: Adjusted the code tags
MVP (Excel 2008-2010)
Post a workbook with sample data and layout if you want a quicker solution.
To help indent your macros try Smart Indent
Please remember to mark threads 'Solved'
thats only works once. i want to change one of the numbers and have the total update.
use textbox change or update
Steve
"Nearly all men can stand adversity, but if you want to test a man's character, give him power."
-Abraham Lincoln
I had the Change but its not working.
[vba]Sub txtq1_Change()
txt1e = txt1q.Value * txt1d.Value
End Sub[/vba]
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
Last edited by Aussiebear; 04-12-2023 at 06:27 PM. Reason: Adjusted the code tags
MVP (Excel 2008-2010)
Post a workbook with sample data and layout if you want a quicker solution.
To help indent your macros try Smart Indent
Please remember to mark threads 'Solved'