Sub CostOfPurchase()
' declare variables
Static allPurchase
Dim newPurchase As String
Dim purchCost As Single
newPurchase = InputBox("Enter the cost of a purchase:")
purchCost = CSng(newPurchase)
allPurchase = allPurchase + purchCost
' display results
MsgBox "The cost of a new purchase is: " & newPurchase
MsgBox "The running cost is: " & allPurchase
End Sub
|