title: If then Else Excel VBA - "End If" needed?
body: <p>so I m writing a UDF in Excel vba of the kind:</p>
  
  <p><code>function ...
  if ... then ... else 
  for i... to ...
  equations
  ...
  next i
  *
  end function</code></p>
  
  <p>Now I noticed, that the function seems to work just fine, however I was wondering whether I shouldnt be using an "end if" at the position of (*) in the code? If I do, I receive an error msg stating there was no if corresponding IF to that "end if" block, though!? So in general, isn't there a Need for an "end if" in if then else constructions ? Thanks in advance! </p>
  
  <p>/edit: 'if ... then ... else' is a one liner. However the else block does contain multiple lines and in particular a loop...</p>