title: Script to scroll Google Sheet works, until I activate another cell. Why?
body: <p>I have a Google Sheet where the top 3 rows, including column headers, are frozen. When user data is entered in cell A1, my script copies it to a cell in a different row of the spreadsheet, and activates that cell so it will be visible to the user, even if that row had been scrolled out of view. All that works properly, until I add the next line of code -to reactivate cell A1 for the next user input. </p>
  
  <p>Here's the sample script I am using to troubleshoot the problem. I am very new to Google Apps Script. Any help will be appreciated.</p>
  
  <pre><code>function onEdit(e) { 
      // Practice script: scroll to show 
      // a cell where new data was just added
  
      var range = e.range;
      var ss = SpreadsheetApp.getActiveSpreadsheet();
      var sheet = ss.getSheets()[0];  
      var cellAddress = e.range.getA1Notation(); 
      var inputCell = 'A1';
      var inputData = sheet.getRange(inputCell).getValue(); // get user input       
  
       // If edited cell was A1, scroll to cell (5,5) and record user input     
       if (cellAddress === inputCell) {
       sheet.getRange(5,5).activate(); 
       sheet.getRange(5,5).setValue(inputData);
  
       // then reactivate inputCell
  
       // If the following line is executed, the sheet won't scroll to (5,5) 
       // sheet.getRange(1,1).activate();
    }
  }
  
  </code></pre>