- As part of an expression in VBA Macro Excel procedure.
- In formulas that you create in a worksheet.
Function DiscountPrice(Price as Currency) as Currency
DiscountPrice = Price * 0.95
End Function
Here's an example how to use the function in a formula:
=DiscountPrice(200)
And this is an example how to use the function in a VBA Macro Excel procedure:
Sub DiscountIt()
inputPrice = InputBox("Enter price: ")
MsgBox "New price: " & DiscountPrice(inputPrice)
End Sub
No comments:
Post a Comment