1
votes

I'm trying to run a code that lets me copy the value of any single cell in one sheet and then paste it into a specific cell in another sheet, however I've been getting errors saying "Range not found".

function Find() {
  var spreadsheet = SpreadsheetApp.getActive();
  var currcell = spreadsheet.getCurrentCell();
  spreadsheet.setActiveSheet(spreadsheet.getSheetByName('Exp GPPB Breakdown'), true);
  spreadsheet.getRange('C1').activate();
  spreadsheet.getRange(currcell).copyTo(spreadsheet.getActiveRange(), SpreadsheetApp.CopyPasteType.PASTE_NORMAL, false);
  spreadsheet.getRange('A4').activate();
  var criteria = SpreadsheetApp.newFilterCriteria()
  .build();
  spreadsheet.getActiveSheet().getFilter().setColumnFilterCriteria(1, criteria);
};
1
Welcome Jose! Check my answer if works for you !soMario

1 Answers

2
votes

Replace

var currcell = spreadsheet.getCurrentCell();

with

var currcell = spreadsheet.getActiveSheet().getCurrentCell().getA1Notation();