Lennart Bosrup
Lennart Bosrup

Reputation: 11

Recorded macro to unhide columns in Google sheets will not run

The recorded macro looks like this:

 function Unhide() {
    var spreadsheet = SpreadsheetApp.getActive();
      spreadsheet.getRange('A:P').activate();
      spreadsheet.getActiveSheet().showColumns(0, 16);
    };

When trying to execute the macro it stops and shows the following error message:

Exception: Those columns are out of bounds

Upvotes: 1

Views: 387

Answers (1)

zackcpetersen
zackcpetersen

Reputation: 81

Try switching your starting index of showColumns() to 1.

function Unhide() {
var spreadsheet = SpreadsheetApp.getActive();
  spreadsheet.getRange('A:P').activate();
  spreadsheet.getActiveSheet().showColumns(1, 16);
};

Upvotes: 2

Related Questions