title: Getting a "Compile Error: Expected: End of Statement" when trying to return a calculated value from a function
body: <p>I have coded a function that finds the first column that has an empty cell in the third row, but I cannot figure out how to return that integer.</p>
  
  <pre><code>Function FindEmptyColumn()
  ' Find the first empty column to paste data into
  
      ThisWorkbook.Activate
      Worksheets("Black Cam Raw Data").Activate
          Dim dCounter As Double
      dCounter = 1
      Dim iColumn As Integer
      Do Until Cells(3, dCounter) = ""
          iColumn = dCounter
          dCounter = dCounter + 1
      Loop
      iColumn = iColumn + 1
  Return iColumn
  
  End Function
  
  Sub CMM_93Cam(ByVal wbTempName As Workbook)
  '
  ' CMM_93Cam Macro
  ' This subroutine imports data from the CMM Report for a 195C93 Cam flatness measurement into this file.
  '
      iColumn = FindEmptyColumn()
  </code></pre>
  
  <p>Basically, I get an error when I type the "Return iColumn" statement.  How do I get the function to return the value I have stored in iColumn?</p>