Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function CreateNewProject() {
- var ThisSheet = SpreadsheetApp.getActive(); //Selects the sheet (should have the macro button)
- var LastRow = ThisSheet.getLastRow(); // The last row that has been entered in the spreadsheet
- var LastCellString = "A"+LastRow+":A"+LastRow; // The string representing the last cell to position to
- var LastCell = ThisSheet.getRange(LastCellString); // The internal variable of the last cell
- var R = LastCell.getRowIndex(); //set value for insertRowsAfter
- var LastRowPlusOne = ThisSheet.getLastRow() + 1;
- var LastCellStringPlusOne = "A"+LastRowPlusOne+":A"+LastRowPlusOne;
- var LastCellPlusOne = ThisSheet.getRange(LastCellStringPlusOne);
- ThisSheet.setActiveRange(LastCell) // Actually perform the repositioning to the last cell
- ThisSheet.insertRowsAfter( R, 1 ); //inserts a new row at the bottom of the sheet
- ThisSheet.setActiveRange(LastCellPlusOne) //adjusts active cell
- ThisSheet.getRange('2:2').copyTo(ThisSheet.getActiveRange(), SpreadsheetApp.CopyPasteType.PASTE_NORMAL, false); //copy & pastes formulas into the last row
- 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
- };
Add Comment
Please, Sign In to add comment