Clear all column's data

One more question is there a way to select a button that would go to a sheet and clear the data from all columns? I realize this could be very dangerous if you make a mistake when setting up you could destroy your sheet. However, once you have the correct sheet selected, I’d like to be able to clear all the data from the answer sheet to make it ready for the next test. Of course, I need to leave the column headings alone; just clear out all the data below.

This would probably require some sort of script set up with an onChange trigger. When you set a value somewhere in your app and it updates the sheet, then the trigger will run and can spin through a sheet you specify and clear out the cells you want in that sheet. Then the script would finally clear out the value that you set to trigger the process.

So I would want something like onChange

select sheet !Tests
select A2:M
perform function Edit menu:Delete values
end selection

Is the right logic (I’ll have to study the syntax)?
I ran a macro to clear the selection to get the syntax.
I guess now I need to figure out how to make it trigger on when a specific string is entered into a specific cell.

Here’s a handful of posts that might help. As far as the trigger, be sure to look for this icon when writing the script. This allows you to set up a trigger. Just make sure it’s an onChange trigger.

image

1 Like