Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function updateTotals(e) {
- if (e.changeType == "FORMAT") {
- SpreadsheetApp
- .getActiveSheet()
- .getRange('A1000')
- .setValue(Math.random());
- }
- }
- function getBackgroundColor(rangeSpecification) {
- var sheet = SpreadsheetApp.getActiveSpreadsheet();
- return sheet.getRange(rangeSpecification).getBackgroundColor();
- }
- function countCellsWithBackgroundColor(colorref, rangeSpecification) {
- var sheet = SpreadsheetApp.getActiveSpreadsheet();
- var range = sheet.getRange(rangeSpecification);
- var x = 0;
- for (var i = 1; i <= range.getNumRows(); i++) {
- for (var j = 1; j <= range.getNumColumns(); j++) {
- var cell = range.getCell(i, j);
- if(cell.getBackgroundColor() == SpreadsheetApp.getActiveSheet().getRange(colorref).getBackground())
- x++;
- }
- }
- return x;
- }
- =countCellsWithBackgroundColor("D4";"E5:AX5"; A1000)
- =countCellsWithBackgroundColor("D4";"E6:AX6"; A1000)
- =countCellsWithBackgroundColor("D4";"E7:AX7"; A1000)
- =countCellsWithBackgroundColor("D4";"E8:AX8"; A1000)
- =countCellsWithBackgroundColor("D4";"E9:AX9"; A1000)
- =countCellsWithBackgroundColor("D4";"E10:AX10"; A1000)
- =countCellsWithBackgroundColor("D4";"E11:AX11"; A1000)
- =countCellsWithBackgroundColor("D4";"E12:AX12"; A1000)
- =countCellsWithBackgroundColor("D4";"E13:AX13"; A1000)
- =countCellsWithBackgroundColor("D4";"E14:AX14"; A1000)
- =countCellsWithBackgroundColor("D4";"E15:AX15"; A1000)
- =countCellsWithBackgroundColor("D4";"E16:AX16"; A1000)
- =countCellsWithBackgroundColor("D4";"E17:AX17"; A1000)
- =countCellsWithBackgroundColor("D4";"E18:AX18"; A1000)
- =countCellsWithBackgroundColor("D4";"E19:AX19"; A1000)
- =countCellsWithBackgroundColor("D4";"E20:AX20"; A1000)
- =countCellsWithBackgroundColor("D4";"E21:AX21"; A1000)
- =countCellsWithBackgroundColor("D4";"E22:AX22"; A1000)
- =countCellsWithBackgroundColor("D4";"E23:AX23"; A1000)
- =countCellsWithBackgroundColor("D4";"E24:AX24"; A1000)
- =countCellsWithBackgroundColor("D4";"E25:AX25"; A1000)
- =countCellsWithBackgroundColor("D4";"E26:AX26"; A1000)
- =countCellsWithBackgroundColor("D4";"E27:AX27"; A1000)
- =countCellsWithBackgroundColor("D4";"E28:AX28"; A1000)
- =countCellsWithBackgroundColor("D4";"E29:AX29"; A1000)
- =countCellsWithBackgroundColor("D4";"E30:AX30"; A1000)
- =countCellsWithBackgroundColor("D4";"E31:AX31"; A1000)
- =countCellsWithBackgroundColor("D4";"E32:AX32"; A1000)
- =countCellsWithBackgroundColor("D4";"E33:AX33"; A1000)
- =countCellsWithBackgroundColor("D4";"E34:AX34"; A1000)
- =countCellsWithBackgroundColor("D4";"E35:AX35"; A1000)
- =countCellsWithBackgroundColor("D4";"E36:AX36"; A1000)
- =countCellsWithBackgroundColor("D4";"E37:AX37"; A1000)
- =countCellsWithBackgroundColor("D4";"E38:AX38"; A1000)
- =countCellsWithBackgroundColor("D4";"E39:AX39"; A1000)
- =countCellsWithBackgroundColor("D4";"E40:AX40"; A1000)
- =countCellsWithBackgroundColor("D4";"E41:AX41"; A1000)
- =countCellsWithBackgroundColor("D4";"E42:AX42"; A1000)
- =countCellsWithBackgroundColor("D4";"E43:AX43"; A1000)
- =countCellsWithBackgroundColor("D4";"E44:AX44"; A1000)
- =countCellsWithBackgroundColor("D4";"E45:AX45"; A1000)
- =countCellsWithBackgroundColor("D4";"E46:AX46"; A1000)
- =countCellsWithBackgroundColor("D4";"E47:AX47"; A1000)
- =countCellsWithBackgroundColor("D4";"E48:AX48"; A1000)
- =countCellsWithBackgroundColor("D4";"E49:AX49"; A1000)
- =countCellsWithBackgroundColor("D4";"E50:AX50"; A1000)
- =countCellsWithBackgroundColor("D4";"E51:AX51"; A1000)
- =countCellsWithBackgroundColor("D4";"E52:AX52"; A1000)
- =countCellsWithBackgroundColor("D4";"E53:AX53"; A1000)
- =countCellsWithBackgroundColor("D4";"E54:AX54"; A1000)
- =countCellsWithBackgroundColor("D4";"E55:AX55"; A1000)
- =countCellsWithBackgroundColor("D4";"E56:AX56"; A1000)
- =countCellsWithBackgroundColor("D4";"E57:AX57"; A1000)
- =countCellsWithBackgroundColor("D4";"E58:AX58"; A1000)
- =countCellsWithBackgroundColor("D4";"E59:AX59"; A1000)
- =countCellsWithBackgroundColor("D4";"E60:AX60"; A1000)
- =countCellsWithBackgroundColor("D4";"E61:AX61"; A1000)
- =countCellsWithBackgroundColor("D4";"E62:AX62"; A1000)
- =countCellsWithBackgroundColor("D4";"E63:AX63"; A1000)
- =countCellsWithBackgroundColor("D4";"E64:AX64"; A1000)
- =countCellsWithBackgroundColor("D4";"E65:AX65"; A1000)
- =countCellsWithBackgroundColor("D4";"E66:AX66"; A1000)
- =countCellsWithBackgroundColor("D4";"E67:AX67"; A1000)
- =countCellsWithBackgroundColor("D4";"E68:AX68"; A1000)
- =countCellsWithBackgroundColor("D4";"E69:AX69"; A1000)
- =countCellsWithBackgroundColor("D4";"E70:AX70"; A1000)
- =countCellsWithBackgroundColor("D4";"E71:AX71"; A1000)
- =countCellsWithBackgroundColor("D4";"E72:AX72"; A1000)
- =countCellsWithBackgroundColor("D4";"E73:AX73"; A1000)
- =countCellsWithBackgroundColor("D4";"E74:AX74"; A1000)
- =countCellsWithBackgroundColor("D4";"E75:AX75"; A1000)
- =countCellsWithBackgroundColor("D4";"E76:AX76"; A1000)
- =countCellsWithBackgroundColor("D4";"E77:AX77"; A1000)
- =countCellsWithBackgroundColor("D4";"E78:AX78"; A1000)
- =countCellsWithBackgroundColor("D4";"E79:AX79"; A1000)
- =countCellsWithBackgroundColor("D4";"E80:AX80"; A1000)
- =countCellsWithBackgroundColor("D4";"E81:AX81"; A1000)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement