dimanche 15 juillet 2018

Adding a If Statement to a Function

What I am trying to do now, is putting an if statement at the beginning.

What I want to do is if Cell L3 <> 6, then stop and provide error "Please fill out all fields".

Note: How do I get this pop-up (previously used msg.box) to appear in the centre of the screen?

If Cell L3 = 6 then run the below function

function moveValuesOnly() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var source = ss.getRange("PNG Sheet!A1:F1");
var destSheet = ss.getSheetByName("Project Codes");
destSheet.appendRow(source.getValues()[0]);
ss.getRange('J7:L8').activate();
ss.getActiveRangeList().clear({contentsOnly: true, skipFilteredRows: true});
ss.getRange('J10:L11').activate();
ss.getActiveRangeList().clear({contentsOnly: true, skipFilteredRows: true});
ss.getRange('J13:L14').activate();
ss.getActiveRangeList().clear({contentsOnly: true, skipFilteredRows: true});

ss.toast('Your Project has been registered')
   }

Aucun commentaire:

Enregistrer un commentaire