I have a sample macros code that I got from recording. So, the code protects the 'C' & 'D' columns whenever I run it.
BUT, What I want is when I run this code second time, it protects the next 2 columns i.e. 'E' and 'F', and so on.
How can I do this.?
Also, Is there a way that this code runs automatically at a set time of a day each day, for a month, so I don't have to manually run the code everyday.
/** @OnlyCurrentDoc */
function DataReWriteProtection() {
var spreadsheet = SpreadsheetApp.getActive();
spreadsheet.getRange('C:D').activate();
var protection = spreadsheet.getRange('C:D').protect();
};
This code may give you a start for developing your own code.
The script should be installed as a Installable, Time Driven, Trigger. You should choose the frequency and execution time that best suits you.