title: CopyTo Paste Values on Google script pastes blanks
body: <p>Below is code that works perfectly until the last line where i try to copy and paste values on the same range.  The formula pulls the correct information, but when the copy paste values is run, all the cells become blank. NOTE: the first cell in the range would calculate as blank.  Please let me know where I've gone wrong!</p>
  
  <pre><code>function CopyTo() {
    var spreadsheet = SpreadsheetApp.getActive();
    var evnt = spreadsheet.getActiveSheet().getActiveCell();
    var rw = evnt.getRow();
    spreadsheet.setActiveSheet(spreadsheet.getSheetByName('Calendar'), true);
  
    var rng = spreadsheet.getActiveSheet().getRange(rw,12,1,365);
    rng.setFormulaR1C1('=iferror(index(CPS,match(RC2,CPRows,0),match((column()-match(RC4,Dateslist,0)-11),CPCol,0)),"")\n');
    rng.copyTo(spreadsheet.getActiveSheet().getRange(rw,12,1,365), SpreadsheetApp.CopyPasteType.PASTE_VALUES, false);
  
   };
  </code></pre>
  
  <p>Thanks very much</p>