title: VB simple script error compiling loop
body: <p>I have a VERY simple script yet it is giving me an error while compiling it:</p>
  
  <pre><code>Sub Unit_Status()
  
      Dim temp, w, j
      On Error Resume Next
  
      For j=0 To 5
          temp = 0
          w = SmartTags("DB400")(j)
  
          If (w And &amp;h10) Then 
              temp=4 '
  
          Else If (w And &amp;h2) Then 
              temp=1 
  
          Else                
              temp=0 
  
          End If
  
          SmartTags("Unit_Status")(j)  =temp
  
      Next
  End Sub
  </code></pre>
  
  <p>The SmartTags is a part of another piece of software. The error I am getting is an 'Unexpected Next'. Shouldn't  For close with Next?</p>
  
  <p>Thank you - I am not familiar with VB just have to use it as a part of another software.</p>