title: Hide/Unhide Columns
body: <p>I'm looking for help with a macro that will show a set of columns then another that will show that same set of columns that is assigned to two separate buttons.</p>
  
  <p>Currently I have the <code>Hide Bootcamp</code> and <code>Show Bootcamp</code> buttons that will accomplish this task, but I know that columns will need to be added in to this work sheet that will throw off the ranges in the future (&lt;> Column I OR Columns BJ:CO). Does anybody have a solution that will keep the range integrity as columns are added/removed to the worksheet?</p>
  
  <p><strong>Worksheet Link</strong></p>
  
  <p><a href="https://docs.google.com/spreadsheets/d/17H9QMJ7Lmznon8G0dO4MGkidE0b6ymrvgt7fTE9gQBw/edit?usp=sharing" rel="nofollow noreferrer">https://docs.google.com/spreadsheets/d/17H9QMJ7Lmznon8G0dO4MGkidE0b6ymrvgt7fTE9gQBw/edit?usp=sharing</a></p>
  
  <p><strong>Current Code Below</strong></p>
  
  <p><strong>Hide Columns</strong></p>
  
  <pre><code>function HideBootcamp() {
    var spreadsheet = SpreadsheetApp.getActive();
  
     spreadsheet.getRange('I:I').activate();
     spreadsheet.getActiveSheet().hideColumns(spreadsheet.getActiveRange().getColumn(), spreadsheet.getActiveRange().getNumColumns());
  
     spreadsheet.getRange('BJ:CO').activate();
     spreadsheet.getActiveSheet().hideColumns(spreadsheet.getActiveRange().getColumn(), spreadsheet.getActiveRange().getNumColumns());
  
     spreadsheet.getRange('A2').activate();
  };
  </code></pre>
  
  <p><strong>Show Columns</strong></p>
  
  <pre><code>function ShowBootcamp() {
    var spreadsheet = SpreadsheetApp.getActive();
  
     spreadsheet.getRange('I:I').activate();
     spreadsheet.getActiveSheet().showColumns(spreadsheet.getActiveRange().getColumn(), spreadsheet.getActiveRange().getNumColumns());
  
     spreadsheet.getRange('BJ:CO').activate();
     spreadsheet.getActiveSheet().showColumns(spreadsheet.getActiveRange().getColumn(), spreadsheet.getActiveRange().getNumColumns());
  
     spreadsheet.getRange('A2').activate();
  };
  </code></pre>