VBA: Else without If Error

On the line with the first If, you must go to a new line after Then, otherwise your If will be implicitely closed.

'Good (in this case)
If <condition> Then    
   DoSomething
   myRow = myRow + 1
Else
   DoSomething Different
End if


'NOT good 
If <condition> Then  DoSomething  
   'the if is now "closed" !!!
   myRow = myRow + 1
Else
   DoSomething Different
End if

Leave a Comment