title: vba enums error: "Invalid inside procedure."
body: <p>I am trying to loop through some cells in EXcel via VBA. I want to use Enums in it, but while running code compiler error appears i.e.: "Invalid inside procedure."</p>
  
  <p>Following is the code snippet:</p>
  
  <pre><code>Dim resSub(1 To 8) As Integer
  
  Private Enum Subjects
      Hindi = 1
      English = 2
      Sanskrit = 3
      Math = 4
      Science = 5
      SoScience = 8
  End Enum
  
  Dim resCur As Integer
  resCur = 0
  Dim resG As Integer
  resG = 0
  Dim resF As Integer
  resF = 0
  Dim markG As Integer
  markG = 0
  
  For j = Hindi To SoScience
      resCur = Sheets("Result").Cells(pst_end_row, ColumnAZ(cpy_start_col + 6 + 2 * j)).Value
      If (resCur &lt; 33) And Not (j = Science) Then
              resSub(j) = 1
              resG = resG + 1
              If (resCur &gt;= 27) Then
                  markG = markG + 33 - resCur
              Else
                  resF = resF + 1
              End If
      ElseIf (resCur &lt; 25) And (j = Science) Then
              resSub(j) = 1
              resG = resG + 1
              If (resCur &gt;= 19) Then
                  markG = markG + 25 - resCur
              Else
                  resF = resF + 1
              End If
      End If
  Next j
  </code></pre>
  
  <p>Could someone please help me over this as I am new to VBA coding?</p>
  
  <p>Thanks,
  AJ</p>
  
  <p>~~~~~~~~~~~~~~~~~~~~~`
  Where there is a shell, there is a way. ;)
  ~~~~~~~~~~~~~~~~~~~~~</p>