Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest Sep 19th, 2018 55 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. function CreateNewProject() {
  2.  
  3.   var ThisSheet = SpreadsheetApp.getActive();   //Selects the sheet (should have the macro button)
  4.   var LastRow = ThisSheet.getLastRow();  // The last row that has been entered in the spreadsheet
  5.   var LastCellString = "A"+LastRow+":A"+LastRow;  // The string representing the last cell to position to
  6.   var LastCell = ThisSheet.getRange(LastCellString); // The internal variable of the last cell
  7.  
  8.   var R = LastCell.getRowIndex();  //set value for insertRowsAfter
  9.  
  10.   var LastRowPlusOne = ThisSheet.getLastRow() + 1;
  11.   var LastCellStringPlusOne = "A"+LastRowPlusOne+":A"+LastRowPlusOne;
  12.   var LastCellPlusOne = ThisSheet.getRange(LastCellStringPlusOne);
  13.  
  14.  
  15.   ThisSheet.setActiveRange(LastCell)  // Actually perform the repositioning to the last cell
  16.   ThisSheet.insertRowsAfter( R, 1 ); //inserts a new row at the bottom of the sheet
  17.   ThisSheet.setActiveRange(LastCellPlusOne) //adjusts active cell
  18.   ThisSheet.getRange('2:2').copyTo(ThisSheet.getActiveRange(), SpreadsheetApp.CopyPasteType.PASTE_NORMAL, false); //copy & pastes formulas into the last row
  19.  
  20.   ThisSheet.getActiveRange().setValue("MaxValuePlusOne"); //sets value for Column A for the last row -- this needs to be Max +1 of all values in column A
  21.  
  22. };
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top