troubleshooting Question

Calculating Sales Tax

Avatar of Sara Hedtler
Sara Hedtler asked on
SalesVBAMicrosoft ExcelMicrosoft Office
13 Comments1 Solution230 ViewsLast Modified:
I've tried to create a Form to Calculate Sales and Taxes, but I'm not able to get the form to work.  Super new to vba, off and on for a few years and its now become imperative for me to get this done.  This is the code i have so far.

Private Sub txtSalesTax_Change()

Me.txtSubtotal.Text = Val(Replace(txtSalesPrice.Text, "$", "")) * Val(Replace(txtSalesTax.Text, "%", "")) / 100

End Sub

Private Sub txtSubtotal_AfterUpdate()

Me.txtSubtotal.Value = Format(txtSubtotal.Text, "$0,00")

End Sub

Private Sub txtSalesTax_AfterUpdate()

Me.txtSalesTax.Text = Val(txtSalesTax.Value) / 100
Me.txtSalesTax.Text = Format(txtSalesTax, "Percent")

End Sub

Private Sub txtTotalSale_Values()
    Dim dbltxtTotalSale As Double

    On Error Resume Next

    dbltxtTotalSale = CDbl(txtSubtotal.Value)
    dbltxtTotalSale = dbltxtSubtotal + CDbl(PriceIncrease.Value) - CDbl(txtSubtotal.Value)
    dbltxtTotalSale = dbltxtTotalSale + CDbl(PriceIncrease.Value)

    txtTotalSale.Value = dbltxtTotalSale
    txtTotalSale = Format(txtTotalSale, "$0.00")

End Sub
Join our community to see this answer!
Unlock 1 Answer and 13 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 13 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros