Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Sub LiveDemo()
- Dim quantity, result As Double
- quantity = 3
- result = quantity * ReturnAmount("water", "Plovdiv")
- Debug.Print result
- End Sub
- Function ReturnAmount(product, town As String)
- If product = "coffee" Then
- If town = "Sofia" Then
- ReturnAmount = 0.5
- ElseIf town = "Plovdiv" Then
- ReturnAmount = 0.4
- ElseIf town = "Varna" Then
- ReturnAmount = 0.45
- End If
- ElseIf product = "water" Then
- If town = "Sofia" Then
- ReturnAmount = 0.8
- ElseIf town = "Plovdiv" Then
- ReturnAmount = 0.7
- ElseIf town = "Varna" Then
- ReturnAmount = 0.7
- End If
- ElseIf product = "beer" Then
- If town = "Sofia" Then
- ReturnAmount = 1.2
- ElseIf town = "Plovdiv" Then
- ReturnAmount = 1.15
- ElseIf town = "Varna" Then
- ReturnAmount = 1.1
- End If
- ElseIf product = "sweets" Then
- If town = "Sofia" Then
- ReturnAmount = 1.45
- ElseIf town = "Plovdiv" Then
- ReturnAmount = 1.3
- ElseIf town = "Varna" Then
- ReturnAmount = 1.35
- End If
- ElseIf product = "peanuts" Then
- If town = "Sofia" Then
- ReturnAmount = 1.6
- ElseIf town = "Plovdiv" Then
- ReturnAmount = 1.5
- ElseIf town = "Varna" Then
- ReturnAmount = 1.55
- End If
- End If
- End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement