Snippets - Conditional Formatting

link - docs.microsoft.com/en-us/office/dev/add-ins/excel/excel-add-ins-conditional-formatting


Excel.run ( function (context) { 
   var _sheet = context.workbook.worksheets.getActiveWorksheet();
   var _range = _sheet.getRange("A1:E10");
   var _conditionalFormat = _range.conditionalFormats.add(Excel.ConditionalFormatType.custom);

   _conditionalFormat.custom.format.fill.color = "yellow";
   _conditionalFormat.custom.rule.formula = "If((AND($E1>100,$E1<300)),TRUE)";

   //alternative syntax
   _conditionalFormat.custom.rule.formula = {formula1: "=100", formula2="=300", operator:"Between"};
}




© 2019 Better Solutions Limited. All Rights Reserved. © 2019 Better Solutions Limited TopPrevNext