I have 6 TextBoxes that I am trying to calculate Currency in. I have the math working fine what I cannot figure out is how to get the last to TextBoxes to show as currency. The user will only be entering information into the first 3 TextBoxes. We are comparing costs example of the three equations are "A * C= D", "B * C= E"," D - E=F " I have the first 2 TextBoxes(A&B) change to currency AfterChange event. TextBox "C" is a quantity so no need for it to show a currency. TextBox "D" is a total of the first equation and have that showing as currency on change event. Textboxes "E & F" I can not show as currency. I have exhausted my limited Knowledge on this. Thank you in advance for any help. Below is the could I currently am using.
VBA Code:
Private Sub TBCCPu1_AfterUpdate()
TBCCPu1.Value = Format(TBCCPu1.Value, "currency")
End Sub
Private Sub TBCCPu1_Change()
If IsNumeric(Me.TBCCPu1.Value) = True Or Me.TBCCPu1.Value = vbNullString Then
'Good data, nothing to MSG
Else
MsgBox "Your input data is not valid"
TBCCPu1 = ""
Exit Sub
End If
If TBCCPu1.Value = "" Then TBCCPu1.Value = 0
If TBCoU1.Value = "" Then TBCoU1.Value = 0
If TBCACoG1.Value = "" Then TBCACoG1.Value = 0
If TBNCPu1.Value = "" Then TBNCPu1.Value = 0
If TBNACoG1.Value = "" Then TBNACoG1.Value = 0
If TBImpact1.Value = "" Then TBImpact1.Value = 0
TBCACoG1.Value = TBCCPu1.Value * TBCoU1.Value
TBNACoG1.Value = TBNCPu1.Value * TBCoU1.Value
TBImpact1.Value = TBCACoG1.Value - TBNACoG1.Value
End Sub
Private Sub TBNCPu1_AfterUpdate()
TBNCPu1.Value = Format(TBNCPu1.Value, "currency")
End Sub
Private Sub TBNCPu1_Change()
If IsNumeric(Me.TBNCPu1.Value) = True Or Me.TBNCPu1.Value = vbNullString Then
'Good data, nothing to MSG
Else
MsgBox "Your input data is not valid"
TBNCPu1 = ""
Exit Sub
End If
If TBCCPu1.Value = "" Then TBCCPu1.Value = 0
If TBCoU1.Value = "" Then TBCoU1.Value = 0
If TBCACoG1.Value = "" Then TBCACoG1.Value = 0
If TBNCPu1.Value = "" Then TBNCPu1.Value = 0
If TBNACoG1.Value = "" Then TBNACoG1.Value = 0
If TBImpact1.Value = "" Then TBImpact1.Value = 0
TBCACoG1.Value = TBCCPu1.Value * TBCoU1.Value
TBNACoG1.Value = TBNCPu1.Value * TBCoU1.Value
TBImpact1.Value = TBCACoG1.Value - TBNACoG1.Value
End Sub
Private Sub TBCoU1_Change()
If IsNumeric(Me.TBCoU1.Value) = True Or Me.TBCoU1.Value = vbNullString Then
'Good data, nothing to MSG
Else
MsgBox "Your input data is not valid"
TBCoU1 = ""
Exit Sub
End If
If TBCCPu1.Value = "" Then TBCCPu1.Value = 0
If TBCoU1.Value = "" Then TBCoU1.Value = 0
If TBCACoG1.Value = "" Then TBCACoG1.Value = 0
If TBNCPu1.Value = "" Then TBNCPu1.Value = 0
If TBNACoG1.Value = "" Then TBNACoG1.Value = 0
If TBImpact1.Value = "" Then TBImpact1.Value = 0
TBCACoG1.Value = TBCCPu1.Value * TBCoU1.Value
TBNACoG1.Value = TBNCPu1.Value * TBCoU1.Value
TBImpact1.Value = TBCACoG1.Value - TBNACoG1.Value
End Sub
Private Sub TBCACoG1_Change()
If TBCCPu1.Value = "" Then TBCCPu1.Value = 0
If TBCoU1.Value = "" Then TBCoU1.Value = 0
If TBCACoG1.Value = "" Then TBCACoG1.Value = 0
If TBNCPu1.Value = "" Then TBNCPu1.Value = 0
If TBNACoG1.Value = "" Then TBNACoG1.Value = 0
If TBImpact1.Value = "" Then TBImpact1.Value = 0
TBCACoG1.Value = TBCCPu1.Value * TBCoU1.Value
TBNACoG1.Value = TBNCPu1.Value * TBCoU1.Value
TBImpact1.Value = TBCACoG1.Value - TBNACoG1.Value
TBCACoG1.Value = Format(TBCACoG1.Value, "currency")
End Sub
Private Sub TBNACoG1_Change()
If TBCCPu1.Value = "" Then TBCCPu1.Value = 0
If TBCoU1.Value = "" Then TBCoU1.Value = 0
If TBCACoG1.Value = "" Then TBCACoG1.Value = 0
If TBNCPu1.Value = "" Then TBNCPu1.Value = 0
If TBNACoG1.Value = "" Then TBNACoG1.Value = 0
If TBImpact1.Value = "" Then TBImpact1.Value = 0
TBCACoG1.Value = TBCCPu1.Value * TBCoU1.Value
TBNACoG1.Value = TBNCPu1.Value * TBCoU1.Value
TBImpact1.Value = TBCACoG1.Value - TBNACoG1.Value
Private Sub TBImpact1_Change()
If TBCCPu1.Value = "" Then TBCCPu1.Value = 0
If TBCoU1.Value = "" Then TBCoU1.Value = 0
If TBCACoG1.Value = "" Then TBCACoG1.Value = 0
If TBNCPu1.Value = "" Then TBNCPu1.Value = 0
If TBNACoG1.Value = "" Then TBNACoG1.Value = 0
If TBImpact1.Value = "" Then TBImpact1.Value = 0
TBCACoG1.Value = TBCCPu1.Value * TBCoU1.Value
TBNACoG1.Value = TBNCPu1.Value * TBCoU1.Value
TBImpact1.Value = TBCACoG1.Value - TBNACoG1.Value