A small macro to make every number in each cell negative.
Created
October 7, 2021 03:01
-
-
Save kitmenke/a76213118bb9de2b4c60ec4d1f061780 to your computer and use it in GitHub Desktop.
Google Apps Script: Make Negative
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function MakeNegative() { | |
var spreadsheet = SpreadsheetApp.getActive(); | |
var activeRange = spreadsheet.getActiveRange(); | |
var values = activeRange.getValues(); | |
values.forEach(function(row, rowId) { | |
row.forEach(function(col, colId) { | |
values[rowId][colId] = Math.abs(values[rowId][colId]) * -1; | |
}); | |
}); | |
activeRange.setValues(values); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment