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 everythiing 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.

1 Answer 1

0

I eventually figured this one out by using the layout from this YouTube channel > https://www.youtube.com/watch?v=M0p4PexixhA

1
  • I'm really glad that you found a solution AND that you saw the value in answering your own question. One thing: Credit the YT video by all means, but it would be a "better answer" if you included your revised code and a snapshot of your screen layout. That is, you showed the inspiration for your answer but you didn't actually show your answer. I do agree that it is appropriate to acknowledge the YouTube video.
    – Tedinoz
    3 hours ago

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.