pili
pili

Reputation: 825

New Google spreadsheet onEdit set focus to a cell not working

If I type a ID in column1, I am trying to get the some text related to that ID and show in column2 and set the focus to column3. This worked perfectly so far and the code is given below. Now I migrated to the new google spread sheet and the focus part is not working. As per the below link this feature is now removed. Is there any other way to do this please?

function onEdit(event)
{
  //Removed some other code for clarity.

  RangeTest();
}



function RangeTest()
{
   var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Sheet1");
   var nextTarget = ss.getRange(2, 2);
   ss.setActiveRange(nextTarget);   
   Logger.log("Focus Set");
}

<sheet>.setActiveRange() seems to have stopped working with onOpen trigger

Google Script - OnEdit problems

Google Sheets getActiveRange on change

Upvotes: 1

Views: 4838

Answers (2)

Wicket
Wicket

Reputation: 38373

Instead of using a simple onEdit trigger use an installable onEdit trigger.

Reference

Upvotes: 0

AshClarke
AshClarke

Reputation: 3078

You can't trigger setActiveRange from an onEdit trigger since April 17 2014

Upvotes: 1

Related Questions