WombatTrax
New Member
- Joined
- Jul 10, 2012
- Messages
- 10
Hey everyone,
Having an issue with a calculation displaying "0" in a text box on a userform if the value is less than "0".
I have two textboxes that do calculations and show the result in a third textbox. I want the third textbox to show a value of "0" if the the calculated value is less than "0". Any help would be great. I've tried a few different If Then statements, but have had no luck. I just can't seem to figure this out even though it seems like it should be relatively simple. Here is the code for the textboxes so far:
Private Sub TextBox3_Change()
If TextBox3.Value = "" Then Exit Sub
TextBox7.Value = CDbl((TextBox3.Value) - 100) / 20
End Sub
Private Sub TextBox4_Change()
If TextBox4.Value = "" Then Exit Sub
TextBox7.Value = CDbl((TextBox4.Value) / 6 + TextBox7.Value)
End Sub
Private Sub TextBox6_Change()
TextBox6.Value = Format(TextBox6.Value, "###")
End Sub
Private Sub TextBox7_Change()
TextBox7.Value = Format(TextBox7.Value, "##")
End Sub
Thanks for any help you can give me.
Having an issue with a calculation displaying "0" in a text box on a userform if the value is less than "0".
I have two textboxes that do calculations and show the result in a third textbox. I want the third textbox to show a value of "0" if the the calculated value is less than "0". Any help would be great. I've tried a few different If Then statements, but have had no luck. I just can't seem to figure this out even though it seems like it should be relatively simple. Here is the code for the textboxes so far:
Private Sub TextBox3_Change()
If TextBox3.Value = "" Then Exit Sub
TextBox7.Value = CDbl((TextBox3.Value) - 100) / 20
End Sub
Private Sub TextBox4_Change()
If TextBox4.Value = "" Then Exit Sub
TextBox7.Value = CDbl((TextBox4.Value) / 6 + TextBox7.Value)
End Sub
Private Sub TextBox6_Change()
TextBox6.Value = Format(TextBox6.Value, "###")
End Sub
Private Sub TextBox7_Change()
TextBox7.Value = Format(TextBox7.Value, "##")
End Sub
Thanks for any help you can give me.