Comment/uncomment all formulas on a matrix using script?

811 viewsScripting
0

I’m trying to comment/uncomment all formulas on a matrix using a script. I found addAll() in the help section but don’t understand if that’s the right action and I have the wrong syntax or if I should be using something else. I’ve attached images of what I tried (throwing a null error),

and what I am trying to achieve.

Thanks!

Tahir Answered question April 3, 2023
0

Hi Jeffc,

Use this script:

|Matrix1|.formulae.each
{allFormulas ->
allFormulas.text = “//” + allFormulas.text
}

Hope this helps,

Tahir

Tahir Posted new comment April 5, 2023

Thank you so much Tahir!! That totally worked. I added it to the beginning and end of the script and reduced the clocking by 90%!

|Matrix1|.formulae.each
{allFormulas ->
allFormulas.text = “//” + allFormulas.text
}

//INSERT REGULAR SCRIPT

|Matrix1|.formulae.each
{allFormulas ->
allFormulas.text = allFormulas.text – “//”
}

I am glad I could help you. This could be relevant to anyone who runs script on large number of calculated cells. Good luck with your model!

Latest Questions