title: iferror statement for macros in vba excel
body: <p>I have a macro that at one point creates a pivot table. My problem is sometimes not all the values are in the second column and I get an error.</p>
  
  <p>I figured a way around this by getting the values from the column to the left which are the same. But with this method if the pivots are the same I get an "error no special cells found".</p>
  
  <p><em>Sorry let me be more clear I have a column A for contract names and column C is a pivot that brings up the values of the contract from another table. Where I am getting the error is column B which has an if statement which basically says if column C is "yes" then use contract names. I still want the value if my if statement in column B produces an error</em> </p>
  
  <p>What I want is something along the lines of</p>
  
  <pre><code>For each cl in range("C1:C200")  
  if error and cl.offset(0, 1).value = yes then    
  cl.value = cl.offste(0, -1) Else
  Cl.value = cl.value
  End if
  </code></pre>