So I have created this small user form to calculate the sales price and profit by filling in the cost and margin.
That works fine.
What I want next is that if I change the sales price the values of margin and profit automatically change.
Or if I change profit then margin and sales price should change.
Textbox1 is cost, textbox2 is margin, etc.
How can I solve this, because now I'm facing issue with the "change" event.
And if you have tips to write better code please let me know!
That works fine.
What I want next is that if I change the sales price the values of margin and profit automatically change.
Or if I change profit then margin and sales price should change.
Textbox1 is cost, textbox2 is margin, etc.
How can I solve this, because now I'm facing issue with the "change" event.
And if you have tips to write better code please let me know!
VBA Code:
Private Sub TextBox2_Change()
On Error Resume Next
If TextBox2.Value = "" Then
TextBox3.Value = ""
TextBox4.Value = ""
Else
TextBox3.Value = Round((TextBox1.Value / ((100 - TextBox2.Value) / 100)), 0)
TextBox4.Value = TextBox3.Value - TextBox1.Value
End If
End Sub
Private Sub TextBox1_Change()
On Error Resume Next
TextBox3.Value = Round((TextBox1.Value / ((100 - TextBox2.Value) / 100)), 0)
TextBox4.Value = TextBox3.Value - TextBox1.Value
End Sub