P
Paul H
I am trying to teach myself VBA and have just been pulling my hair out with
the following:
Public Sub name1()
Dim x As String
x = InputBox("Enter your name:")
If x = Paul Then MsgBox ("Hello, Paul")
ElseIf x <> Paul Then MsgBox ("Hello" & x)
End If
End Sub
Everytime I debug using F8 I get an error message saying Else without If. I
know I am only learning but surely there is an If at the start of line 4.
The help info is not much help as it seems to say the problem is before the
indicated problem, but I can't see it. So to stop an old man going mad can
you please help and explain what I am doing wrong.
the following:
Public Sub name1()
Dim x As String
x = InputBox("Enter your name:")
If x = Paul Then MsgBox ("Hello, Paul")
ElseIf x <> Paul Then MsgBox ("Hello" & x)
End If
End Sub
Everytime I debug using F8 I get an error message saying Else without If. I
know I am only learning but surely there is an If at the start of line 4.
The help info is not much help as it seems to say the problem is before the
indicated problem, but I can't see it. So to stop an old man going mad can
you please help and explain what I am doing wrong.