title: Excel vba : Type range and cell
body: <p>I am bit confused by cell and range in vba (excel).
  Logically, i could think a cell as a range with size = 1; and I think it is easy to make a range out of a cell.</p>
  
  <p>If I read the api of EntireRow property <a href="http://msdn.microsoft.com/en-us/library/ff836836.aspx" rel="noreferrer">here</a>
  it operates on range. But, the below code work, indicating 'cell'variable inside the loop is a range</p>
  
  <pre><code>Set import = Sheets("import")
      Set spRange = import.Range("A2")
      Set spRange = import.Range("A2:" &amp; spRange.End(xlDown).Address)
      For Each cell In spRange
          dict.Add cell.Offset(0, 2).Text, cell.EntireRow
      Next cell
  </code></pre>
  
  <p>At the same time, the below code returns an error indicating type mismatch when call the <strong>removecell</strong> function. What should be the type of <strong>targetCell</strong> in the function definition?</p>
  
  <pre><code>Set spRange = mySheet.Range("b2", mySheet.Range("b2").End(xlDown))
  For Each cell In spRange
      val = removecell (cell)
  Next cell
  
  
  Public Function removecell(targCell As Range) As Boolean
      removecell = False
  End Function
  </code></pre>