I would suggest to have a read at Simple Triggers and Installable Triggers.
Basically you can create any function and make it trigger using the ScriptApp class and those are called installable trigger.
But there are special functions that don't need to go through ScriptApp to get triggered, you just need to change the name of the function, and that would start enabling the trigger of those functions.
Simple trigger
Just change the name of the function so it will automatically start triggering.
function onEdit(e) {
var ss = SpreadsheetApp.getActiveSpreadsheet ();
var source = ss.getRange ("Copy!A1:N200");
var destSheet = ss.getSheetByName("Paste");
var destRange = destSheet.getRange(destSheet.getLastRow()+1,1);
source.copyTo (destRange, {contentsOnly: true});
}
Installable Trigger
Create another function to execute on time to create the trigger
function moveValuesOnly(e) {
var ss = SpreadsheetApp.getActiveSpreadsheet ();
var source = ss.getRange ("Copy!A1:N200");
var destSheet = ss.getSheetByName("Paste");
var destRange = destSheet.getRange(destSheet.getLastRow()+1,1);
source.copyTo (destRange, {contentsOnly: true});
}
function createTrigger(){
var ss = SpreadsheetApp.getActive();
ScriptApp.newTrigger('moveValuesOnly')
.forSpreadsheet(ss)
.onEdit()
.create();
}
You have specified in your code that only want to trigger when the cell is A10, but this is impossible as of right now. You need to create an if statement making sure the range being edited is the one you care about.
Look at the event objects because that would be input parameter of the trigger functions (e). That object has information about the range and spreadsheet being edited.
Basically make a condition with the e object
function onEdit(e) {
var range = e.range;
var newValue = e.value;
var oldValue = e.oldValue;
var sheet = range.getSheet();
if(sheet.getName() == "<Your sheet name>" && newValue == 2 && range.getColumn() == 1 && range.getRow() == 10){
// Browser.msgBox("Edit entered condition");
//
// Do your stuff here when the condition is satisfied
}
}