Hi, I'm new to script. I got the buttons to work, but even with the provided script, I cannot get the checkboxes to function. My quantity, increase, and decrease are in columns f, g, h (respectively) but I cannot get the script to function. Do you have suggestions?
do i need to install some extensions or something? i tried to copy the code from description and created the sheet from scratch like exactly in the vid. but it seems that the sheet is not connected on the app script?
Muito obrigado pelo video, eu cheguei a fazer uma função para cada botão e isso estava me enlouquecendo. Mas realmente gostaria de passar as cédulas por parâmetro, isso tornaria as coisas mais fáceis. Tem alguma ideia do porque o Google bloqueia essa ação?
I would like to use this function for my spreadsheet, but I have no idea how to get it to work. The value that has to be increased/decreased is in column F and I need 12 checkboxes in column H to column S. I currently have over 100 rows that I manually check every week and increase the value manually by using a calculator to set the new value. Would it be possible to achieve this and if so, how? I am a complete noob when it comes to this stuff, but I would love to make my work a lot easier and faster. Thanks!
got the code to work, but what if I wanted to increment a value on another sheet? what part of the code do I have to edit to increment in a different cell on a different sheet?
Thanks for this video. I tried the code and it doesn't seem to be working for me. I click the checkbox and nothing happens. But there are no errors on my code. Hmm.
function incrementAndDecrement(e){ const src = e.source.getActiveSheet(); const r = e.range; if (src.getName() != "Checkbox" || r.columnStart < 2 || r.columnStart > 3) return; let out; if (r.columnStart == 2){ out = r.offset(0,-1); out.setValue(out.getValue()+1) } else { out = r.offset(0,-2); out.setValue(out.getValue()-1) } r.setValue("FALSE"); } My form looks the same as yours. Am I missing something? @@SpencerFarris
Hi Sentinaut, just replace the 'less_than_carat' with < and the 'greater_than_carat' with > and hit save and should be good to go. Also make sure your sheet name (tab at the bottom) is named the same thing as what's in this line if (src.getName() != "Checkbox". Ex. if your sheet tab is called ABC, then change "Checkbox" to "ABC".
Can you help me? The code simply does not work for me. I have a much simpler thing I need where I only need to INCREMENT a row of numbers with a checkbox. Nothing else. edit: Decided to just re-design my huge sheet around your (working) document that you provided in the description. Took a bit of time and I still have no idea why I wasn't able to just copy-paste your code into my document, but I was able to copy-paste my document into your file... coding shenanigans.
@@TechSupportDave Could it be because of the check he added to be sure that the sheet name was "Checkbox"? That would explain why copy pasting his code in your sheet did not work but the other way around did.
@@yannickrasschaert8064 Maybe! Well, it's a simple skill issue if I can't get simple code to work, even if it is in an unfamiliar language. I'm much more informed now and don't experience these kinds of basic issues with sheets anymore.
had to modify for my use case but super helpful thanks dude
That's the hope, glad it worked!
Hi, I'm new to script. I got the buttons to work, but even with the provided script, I cannot get the checkboxes to function. My quantity, increase, and decrease are in columns f, g, h (respectively) but I cannot get the script to function. Do you have suggestions?
do i need to install some extensions or something? i tried to copy the code from description and created the sheet from scratch like exactly in the vid. but it seems that the sheet is not connected on the app script?
If you created the script from Extensions > "Apps Script" from the spreadsheet then it's already connected
Thanks for this! Is it possible to make this work across multiple sheets at once?
absolutely
Muito obrigado pelo video, eu cheguei a fazer uma função para cada botão e isso estava me enlouquecendo. Mas realmente gostaria de passar as cédulas por parâmetro, isso tornaria as coisas mais fáceis. Tem alguma ideia do porque o Google bloqueia essa ação?
Não sei. Gostaria se for possível, mas obviosamente não é. Por que não quer user os checkboxes?
I would like to use this function for my spreadsheet, but I have no idea how to get it to work. The value that has to be increased/decreased is in column F and I need 12 checkboxes in column H to column S. I currently have over 100 rows that I manually check every week and increase the value manually by using a calculator to set the new value. Would it be possible to achieve this and if so, how? I am a complete noob when it comes to this stuff, but I would love to make my work a lot easier and faster. Thanks!
Should be totally possible. Can you add me as an editor so we can look at it best?
@@SpencerFarris I have managed to get it working by asking a friend for help. Thanks for replying though!
@@lights8227 I'm glad you were able to get it working
got the code to work, but what if I wanted to increment a value on another sheet? what part of the code do I have to edit to increment in a different cell on a different sheet?
What do I need to change to execute this across all the sheets in a workbook?
Get rid of src.getName() != "Checkbox" in the IF statement
Hello Spencer how about if I need 2 column to increase and decrease how should I script it? thank you for your reply
Meaning what, exactly? A single checkbox should change both?
@@SpencerFarris example I have 6 columns A-F. A for Count, C&D for increase and decrease. but I also want to put another set at Column D,E & F
@@Employee1-rl3wd if (r.columnStart == 2 || r.columnStart == 5){
...
} else if (r.columnStart == 3 || r.columnStart == 6){
...
}
@@SpencerFarris Thank you very much : )
From India 👍
Thanks for this video. I tried the code and it doesn't seem to be working for me. I click the checkbox and nothing happens. But there are no errors on my code. Hmm.
Without seeing your sheet or at least your code I can't really help troubleshoot
function incrementAndDecrement(e){
const src = e.source.getActiveSheet();
const r = e.range;
if (src.getName() != "Checkbox" || r.columnStart < 2 || r.columnStart > 3) return;
let out;
if (r.columnStart == 2){
out = r.offset(0,-1);
out.setValue(out.getValue()+1)
} else {
out = r.offset(0,-2);
out.setValue(out.getValue()-1)
}
r.setValue("FALSE");
}
My form looks the same as yours.
Am I missing something?
@@SpencerFarris
Syntax error: SyntaxError: Unexpected identifier 'less_than_carat' line: 11 file: On Edit.gs
Hi Sentinaut, just replace the 'less_than_carat' with < and the 'greater_than_carat' with > and hit save and should be good to go.
Also make sure your sheet name (tab at the bottom) is named the same thing as what's in this line if (src.getName() != "Checkbox". Ex. if your sheet tab is called ABC, then change "Checkbox" to "ABC".
@@tylerboston1714 Thanks Tyler! @Sentinaut, RUclips doesn't allow the carat symbols < or > in the description.
@@SpencerFarris ah I see
Can you help me? The code simply does not work for me. I have a much simpler thing I need where I only need to INCREMENT a row of numbers with a checkbox. Nothing else.
edit: Decided to just re-design my huge sheet around your (working) document that you provided in the description. Took a bit of time and I still have no idea why I wasn't able to just copy-paste your code into my document, but I was able to copy-paste my document into your file... coding shenanigans.
Did it work?
@@SpencerFarris yes, but i have no idea why it works! hahah
@@TechSupportDave Could it be because of the check he added to be sure that the sheet name was "Checkbox"?
That would explain why copy pasting his code in your sheet did not work but the other way around did.
@@yannickrasschaert8064 Maybe! Well, it's a simple skill issue if I can't get simple code to work, even if it is in an unfamiliar language. I'm much more informed now and don't experience these kinds of basic issues with sheets anymore.
@@yannickrasschaert8064 Can't thank you enough for this. Renaming my tab solved a similar problem for me. +1