Hello,

I have an example of something i am trying to complete, but keep getting an error.

The "If, Then" part of the statement works, but when I add the "Else" statement, it gives me a compile error- "Else without If." I do not understand this because I have an "If" prior to the "Else". Please assist.

*Reminder: This is just a practice example for me to understand how to code an If, Then, Else statement.


Private Sub CommandButton1_Click()



Dim UPFORB As Integer


UPFORB = 67



Range("A1:C3").Value = UPFORB - 19

If Range("A2").Value = UPFORB - 9 Then MsgBox "The new amount is " & UPFORB - 7 & "."

Else: MsgBox "The number does not fit the criteria!"

End If


End Sub