title: Paste Values in Excel C#
body: <p>Hello I have been trying to use the <a href="https://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel.range.pastespecial.aspx" rel="nofollow">PasteSpecial</a> paste values on another sheet but every thing I've tried I keep receiving the same error. </p>
  
  <blockquote>
    <p>PasteSpecial method of Range class failed</p>
  </blockquote>
  
  <pre><code>xl.Application xlApp = Globals.ThisWorkbook.Application;
  xl.Workbook wb = xlApp.ActiveWorkbook;
  xl.Worksheet data = wb.Sheets["Data"];
  xl.Worksheet datasheet = wb.Sheets["DataSheet"];
  xl.Worksheet pivot = wb.Sheets["Pivot"];
  xl.Range dataRng = data.Range["A1:C" + 
        xlApp.WorksheetFunction.CountA(data.Range["A:A"])];
  xl.Range pivotRng = pivot.Range["A1"];
  
  addPivot ap = new addPivot();
  ap.DataRange = dataRng;
  ap.DestRng = pivotRng;
  ap.PivotSheet = pivot;
  ap.createPivot("FullName","Date");
  
  pivot.PivotTables("PivotTable1").NullString = "0";
  pivot.UsedRange.Copy();   
  
  datasheet.Range["A2:GT999"].ClearContents();  
  
  datasheet.Range["A2"].PasteSpecial(xl.XlPasteType.xlPasteValues, 
                                     xl.XlPasteSpecialOperation.xlPasteSpecialOperationNone, 
                                     System.Type.Missing, System.Type.Missing);
  
  datasheet.Range["2:2"].ClearContents();
  </code></pre>
  
  <p>I have Tried </p>
  
  <pre><code>datasheet.Range["A2"].PasteSpecial(xl.XlPasteType.xlPasteValues
  
  datasheet.Range["A2"].PasteSpecial(xl.XlPasteType.xlPasteValues, 
                                     xl.XlPasteSpecialOperation.xlPasteSpecialOperationNone)
  </code></pre>
  
  <p>and what you see above.</p>
  
  <p>thanks!</p>