Hi experts
I face problem How can I distrube values for COSTING (textbox7) on others textboxes 13,14,15,16,17( BALANCE) .
the first step for my project fill QTY,PRICE then will calculate and show in the BALANCE and sum the SUBTOTAL in textbox 6 this is ok
the second step when I fill COSTING(textbox7 ) then textbox7 / textbox 6 and the result should multiply for each textbox in BALANCE after that should sum over previous value. let's take example I suppose textbox1=10 , textbox2=30, calculation in textbox13= 300and textbox 6 =300 if I write 200 in textbox7 then
first I want this 200/300=0.66666 ,this should be =0.66666X300(textbox13)=200 and this result should add over the value in textbox 13(300) then the final value in text box13=500
the code doesn't work as what I want sometimes gives wrong values and somtimes doesn't gives any thing If I don't fill all of the textboxes but no in all of about I need filling all of textboxes.
Private Sub TextBox7_AfterUpdate()
Dim tot, tot1, tot2, tot3, tot4 As Double
Dim exp As Double
If TextBox1 <> "" And TextBox8 <> "" And TextBox13 <> "" And TextBox7.Value <> "" Then
If TextBox2 <> "" And TextBox9 <> "" And TextBox14 <> "" And TextBox7.Value <> "" Then
If TextBox3 <> "" And TextBox10 <> "" And TextBox15 <> "" And TextBox7.Value <> "" Then
If TextBox4 <> "" And TextBox11 <> "" And TextBox16 <> "" And TextBox7.Value <> "" Then
If TextBox5 <> "" And TextBox12 <> "" And TextBox17 <> "" And TextBox7.Value <> "" Then
tot = CDbl(TextBox1.Value) * CDbl(TextBox8.Value)
tot1 = CDbl(TextBox2.Value) * CDbl(TextBox9.Value)
tot2 = CDbl(TextBox3.Value) * CDbl(TextBox10.Value)
tot3 = CDbl(TextBox4.Value) * CDbl(TextBox11.Value)
tot4 = CDbl(TextBox5.Value) * CDbl(TextBox12.Value)
If TextBox7 <> "" Then
exp = CDbl(TextBox7.Value) / CDbl(TextBox6.Value)
' If TextBox7 = "" Then Call SUM_VALUES
TextBox13.Value = tot * (1 + exp)
TextBox14.Value = tot1 * (1 + exp)
TextBox15.Value = tot2 * (1 + exp)
TextBox16.Value = tot3 * (1 + exp)
TextBox17.Value = tot4 * (1 + exp)
End If
End If
End If
End If
End If
End If
TextBox7.Value = Format(TextBox7.Value, "#,###.00")
End Sub