torminator111
New Member
- Joined
- Jul 16, 2014
- Messages
- 2
Hi All!
I have been experiencing this issue in a few macros I've created and don't understand what is wrong with any of the syntax structures I've been experimenting with. When I run the code, it doesn't compile and gives me a message that says "Else without If." From online research, it seems that the syntax is correct. Any ideas?
Structure 1 (If, ElseIf, Else
:
If vara = "NA" Or varb = "W" GoTo Proceed
ElseIf varx = "" Or vary = "" Or varz = "" _
Then MsgBox "Main Information missing, please check Main entries", vbExclamation: GoTo Suspend
Else: GoTo Suspend
End If
Structure 2 (nested Ifs):
If varx = "" Or vary = "" Or varz = "" Then
If vara = "NA" Or varb = "W" GoTo Proceed
Else: MsgBox "Main Information missing, please check Main entries", vbExclamation: GoTo Suspend
End If
Else: GoTo Proceed
End If
Structure 3 (complex If conditions):
If (vara = "NA" Or varb="W") And (varx="" Or vary="" Or varz="") GoTo Proceed
Else: MsgBox "Main Information missing, please check Main entries", vbExclamation: GoTo Suspend
End If
Thank you SO MUCH in advance for your help!
I have been experiencing this issue in a few macros I've created and don't understand what is wrong with any of the syntax structures I've been experimenting with. When I run the code, it doesn't compile and gives me a message that says "Else without If." From online research, it seems that the syntax is correct. Any ideas?
Structure 1 (If, ElseIf, Else

If vara = "NA" Or varb = "W" GoTo Proceed
ElseIf varx = "" Or vary = "" Or varz = "" _
Then MsgBox "Main Information missing, please check Main entries", vbExclamation: GoTo Suspend
Else: GoTo Suspend
End If
Structure 2 (nested Ifs):
If varx = "" Or vary = "" Or varz = "" Then
If vara = "NA" Or varb = "W" GoTo Proceed
Else: MsgBox "Main Information missing, please check Main entries", vbExclamation: GoTo Suspend
End If
Else: GoTo Proceed
End If
Structure 3 (complex If conditions):
If (vara = "NA" Or varb="W") And (varx="" Or vary="" Or varz="") GoTo Proceed
Else: MsgBox "Main Information missing, please check Main entries", vbExclamation: GoTo Suspend
End If
Thank you SO MUCH in advance for your help!