I have a script that inserts a new row (8)in a spreadsheet and copies data from row 9. The script is triggered from a button linked to the script. Everything works fine except when the script is finished and I start typing I don't see any data. The new row 8/col 3 should be active. It does have a blue box around it, but doesn't accept data until I click on it.
function InsertTran()
{
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheetByName("Transactions");
var row = 8;
var newrow = 9;
//var lastrow = sheet.getLastRow();
var lastcolumn = sheet.getLastColumn();
sheet.getRange('a8').activate();
sheet.insertRowBefore(sheet.getActiveCell().getRow());
var source_range = sheet.getRange(row+1,1,1,lastcolumn);
var target_range = sheet.getRange(row,1,1,lastcolumn);
source_range.copyTo(target_range);
sheet.getRange(row,2).activate();
sheet.getActiveCell().setValue(new Date()).setNumberFormat("MM/DD/YY");
sheet.getRange(row,3).activate();
sheet.getActiveCell().setValue("");
sheet.getRange(row,4).activate();
sheet.getActiveCell().setValue("");
sheet.getRange(row,5).activate();
sheet.getActiveCell().setValue(0);
sheet.getRange(row,6).activate();
sheet.getActiveCell().setValue(0);
sheet.getRange(row,7).activate();
sheet.getActiveCell().setValue("O");
sheet.getRange(row,3).activate();
}