You are correct! Sorry you have to paste it into the editor for now. Eventually you will be able to select the script from the
Templates menu of the script editor, which will automatically choose the correct language. But I want to make sure it’s useful first. (thank you, also, for testing my script )
I am assuming you were using the
Run selected code feature? Unfortunately, running only parts of a macro doesn’t always work. In this case the problem is that I declare a few variables so that you can tune the output to your particular dataset. These variables only “exist” when the macro runs. So, if you partially execute the macro and create these variables, and then try to run later parts via
Run selected code, it will have forgotten the existence of these variables which is why you got the odd error message.
Would you feel comfortable trying again, now that you know that the whole macro should be executed? It looks like the processing you’re doing is very straightforward so I am confident that this macro can fit your needs, with minor changes. It’s also valuable for me to see what problems you encounter (for example, I will now add a warning about “run selected code” use!).
Anyway if you can’t get it to work just let me know!
P.S. if you want to temporarily disable part of the macro, you can comment it out with multi-line comments, like this:
here is an active line of code
none of the code
between these comment markers
will be executed