Private Sub UserForm_Activate()
UserForm1.ComboBox1.RowSource = "A1:A2"
With form1
If UserForm1.ComboBox1.Value = 3 Then
TextBox5.Text = Val(TextBox4.Value) - Val(TextBox3.Value) * 0.8 / 100
Else
TextBox5 = Val(TextBox4.Value) - Val(TextBox3.Value) * 1.6 / 100
End If
TextBox5 = Format(TextBox5, "#,##0.00")
End With
End Sub
Private Sub TextBox1_Change()
TextBox3.Text = Val(TextBox1.Value) * 14
TextBox4.Text = Val(TextBox3.Value) * 80 / 100
TextBox3 = Format(TextBox3, "#,##0.00")
TextBox4 = Format(TextBox4, "#,##0.00")
With form1
If UserForm1.ComboBox1.Value = 3 Then
TextBox5.Text = Val(TextBox4.Value) - Val(TextBox3.Value) * 0.8 / 100
Else
TextBox5 = Val(TextBox4.Value) - Val(TextBox3.Value) * 1.6 / 100
End If
TextBox5 = Format(TextBox5, "#,##0.00")
TextBox11 = Format(TextBox11, "#,##0.00")
End With
End Sub
Private Sub TextBox2_Change()
If TextBox1.Text <> "" Then
TextBox3.Text = Val(TextBox1.Value) * 14 + Val(TextBox2.Value)
Else
TextBox3.Text = Val(TextBox2.Value)
End If
TextBox4.Text = Val(TextBox3.Value) * 80 / 100
TextBox3 = Format(TextBox3, "#,##0.00")
TextBox4 = Format(TextBox4, "#,##0.00")
With form1
If UserForm1.ComboBox1.Value = 3 Then
TextBox5.Text = Val(TextBox4.Value) - Val(TextBox3.Value) * 0.8 / 100
Else
TextBox5 = Val(TextBox4.Value) - Val(TextBox3.Value) * 1.6 / 100
End If
TextBox11.Text = Val(TextBox5.Value) / Val(TextBox1.Value)
TextBox5 = Format(TextBox5, "#,##0.00")
TextBox11 = Format(TextBox11, "#,##0.00")
End With
End Sub
Private Sub ComboBox1_Change()
If UserForm1.ComboBox1.Value = 3 Then
TextBox5.Text = Val(TextBox4.Value) - Val(TextBox3.Value) * 0.8 / 100
Else
TextBox5 = Val(TextBox4.Value) - Val(TextBox3.Value) * 1.6 / 100
End If
TextBox11.Text = Val(TextBox5.Value) / Val(TextBox1.Value)
End Sub
Private Sub UserForm_Click()
End Sub |