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

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)