I have a simple macro in Google Sheets that I can run from Tools > Macros > MacroName. I have it set up with a trigger to run when the spreadsheet is first opened. (All the macro does is go to the first empty cell in column A, from https://webapps.stackexchange.com/a/101200)
However, what I would really like to do is to have this macro run every/any time the active sheet is changed in my spreadsheet. So when I click on a sheet's tab at the bottom of the screen to open a different sheet (in the same google sheets spreadsheet file), the macro runs. If I change back to the previous worksheet tab the macro runs, etc.
In Excel there's a function Worksheet.Activate which I believe would do what I want there, but I can't find a matching function in Google Sheets.
How can I get a macro to run when the active sheet changes? (Only within the one spreadsheet)