title: How do I Increase cell value in Excel using VBA? Error: Type mismatch
body: <p>I'm writing a macro, but because I'm working for first time in vb, I faced problems.</p>
  
  <p>My code:</p>
  
  <pre><code>Cells (1, 1).Select
  Dim tempvar As Integer
  tempvar = Val(Selection.Value) // error
  Selection.Value = tempvar + 1
  </code></pre>
  
  <p>What my code should be:</p>
  
  <pre><code>Cells(1,1).Value+=1
  </code></pre>
  
  <p>I get error "type mismatch". How do I accomplish that?</p>
  
  <p><strong>EDIT</strong>: Row 1, Cell 1 is merged. It consists of 4 columns, so it is Row 1, Cell 1,2,3,4 in one column. If the cell is not merged then there is no problem.</p>