I am using some VBA in excel and I have a simple group of if/else if statements that isn't behaving properly. Here is my code:
insertionFee and startPrice are both declared as Doubles and startPrice is set previously through an inputbox. When a high value such as 150 is entered, startPrice is set to .35 instead of the proper value. What can possibly be the cause of this? Thanks.
Code:
insertionFee = 0
If startPrice <= 0.99 Then
insertionFee = 0.2
ElseIf startPrice >= 1 & startPrice <= 9.99 Then
insertionFee = 0.35
ElseIf startPrice >= 10 & startPrice <= 24.99 Then
insertionFee = 0.6
ElseIf startPrice >= 25 & startPrice <= 49.99 Then
insertionFee = 1.2
ElseIf startPrice >= 50 & startPrice <= 199.99 Then
insertionFee = 2.4
ElseIf startPrice >= 200 & startPrice <= 499.99 Then
insertionFee = 3.6
Else
insertionFee = 4.8
End If
insertionFee and startPrice are both declared as Doubles and startPrice is set previously through an inputbox. When a high value such as 150 is entered, startPrice is set to .35 instead of the proper value. What can possibly be the cause of this? Thanks.