Hi
The code below will not run if I do not type End If as my last line. However the second code I do not need EndIf? Why? thank you.

[code] If x > 10 Then MsgBox ("greater than 10") [code]

Sub myif()
    'to use if
    Dim x As Integer
    x = InputBox("enter number")
    If x > 10 Then
        MsgBox ("greater than 10")
End Sub
Sub myif()
    'to use if
    Dim x As Integer
    x = InputBox("enter number")
    If x > 10 Then  MsgBox ("greater than 10")
End Sub