Quantcast
Channel: Hot Weekly Questions - Web Applications Stack Exchange
Viewing all articles
Browse latest Browse all 9786

Why does my onEdit macro error when checking on an edit in a specific cell and sheet?

$
0
0

I've been battling with this for several days and used many previous answers found on these site, as well as a few others, but still can't get my script to run as intended.

I have a dropdown box on one cell (B3) in my google sheet, and I want an edit in that cell to trigger a macro. I had it kind of working, but the macro was triggered by changes on other sheets of the same workbook, which screwed up the content of that incorrect sheet.

I tried to add a couple of 'if' statements to firstly check the sheet name is correct, then check that the active cell is the one I want to trigger the rest of the code, but this is where I'm stuck getting the following error message "TypeError: activeSheet.getRange.getA1Notation is not a function"

I've attached the code up to where it errors, as I know that everything below it works fine.

function hltcells(){  var activeSheet = SpreadsheetApp.getActiveSheet();  var sheetNameTest = activeSheet.getSheetName();  if(activeSheet.getSheetName() == 'Pax Split Sheet'){  if (activeSheet.getRange.getA1Notation() === 'B3'){

N.B. I've tried this same essential code using the onEdit(e) type of trigger, but still no joy.


Viewing all articles
Browse latest Browse all 9786

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>