I need some VBA(excel) help. This is what I was given: \'Review the attached dat
ID: 3861310 • Letter: I
Question
I need some VBA(excel) help. This is what I was given: 'Review the attached data on the 'Data worksheet'. The data represents the Sales Tax information for the 50-city States in US. 'Create two functions that computes the following for each state: 'StateTax: ListedPrice * State Tax Rate 'Local Tax Rate: ListedPrice * Local Tax rate 'Determine Sales Amount as: ListedPrice + StateTax + LocalTax 'TotalTax as StateTax + LocalTax 'DiscountOpportunity as: MINIMUM(ListPrice * 2%, SalesTax * 1.5%) These are the two subs I was given to work off of: Sub Part-A() Open textfile userCarDealership.txt Read the first 25 records, and then display those 25 records as Tab-delimited rows/lines in ONE Messagebox. End Sub Sub Part-B() Open textfile userCarDealership.txt Read the first 25 records, and load the records into the spreadsheet. Note: the starting cell for the load is A2. End Sub
Explanation / Answer
Option Explicit
Private Sub TaxCal_Click()
Dim MPrice As Currency
Dim TaxRate As Double
Dim TaxAmount As Currency
Dim NetPrice As Currency
MPrice = CCur(txtMPrice.Text)
TaxRate = txtTaxRate.Text / 100
TaxAmount = MPrice * TaxRate
NetPrice = MPrice + TaxAmount
txtMPrice.Text = FormatCurrency(MPrice)
txtTaxAmount.Text = FormatCurrency(TaxAmount)
txtNetPrice.Text = FormatCurrency(NetPrice)
End Sub
Private Sub cmdClose_Click()
End
End Sub