title: Google Sheet Apps Script - Change Cell Data and Increment One Row Down
body: <p>I'm trying to.. 1) replace a substring from the contents of the active cell in my sheet, and.. 2) move the active cell down one spot, and repeat until the active cell value is empty. Here's my function, but nothing happens when I run it...can anyone see why?   </p>
  
  <pre><code>  var app = SpreadsheetApp;            
    var mySheet = ss.getSheetByName('NAME');
    var activeCell = mySheet.getActiveCell();
    var cellValue = activeCell.getValue();
    var activeRow = activeCell.getRow();
  
    function replaceStringInCell(){
       while(cellValue != ''){
         var newCellValue = cellValue.replace('MC/Visa/Discover', 'CC');
         activeCell.setValue(newCellValue); 
         activeRow++;
         mySheet.getRange(activeRow, 7).activate();
    }
  }
  </code></pre>