Question: Sub CalcTotal() 'declare variables Dim Quantity As Integer Dim Price As Currency Dim Membership As String Dim extendedprice As Double Dim cashbackpercentage As Double Dim

Sub CalcTotal() 'declare variables Dim Quantity As Integer Dim Price As Currency Dim Membership As String Dim extendedprice As Double Dim cashbackpercentage As Double Dim cashbackamount As Double Dim totalaftercashback As Double Dim minpurchase As Double Dim encouragementthreshold As Double 'assign variables Quantity = Range("B3").Value Price = Range("B4").Value Membership = Range("B7").Value cashbackpercentage = Range("B8").Value minpurchase = Range("B22").Value encouragementthreshold = Range("B24").Value 'calculate extended price extendedprice = Quantity * Price Range("B5").Value = extendedprice 'calculate cashbackpercentage Select Case Membership Case "Gold" cashbackpercentage = Range("B16").Value Case "Platinum" cashbackpercentage = Range("B17").Value Case "Black" cashbackpercentage = Range("B18").Value Case Else cashbackpercentage = 0 End Select 'calculate cashback amount if extended price meets or exceeds min purchase If extendedprice >= minpurchase Then cashbackamount = extendedprice * cashbackpercentage Range("B10").Value = cashbackamount Else Range("B10").Value = 0 End If 'calculate total after cashback totalaftercashback = extendedprice - Range("B10").Value Range("B11").Value = totalaftercashback 'display message box encouraging customer to purchase if cashback amount meets or exceeds encouragement threshold If Range("B10").Value >= encouragementthreshold Then MsgBox ("Make the Purchase!") End If End Sub

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Accounting Questions!