Conditional Formatting


This script applies green fill conditional formatting to the top 10% of values in the used range.

function main(workbook: ExcelScript.Workbook) { 
  let selectedSheet = workbook.getActiveWorksheet();
  let range = selectedSheet.getUsedRange();

  let conditionalFormat = range.addConditionalFormat(ExcelScript.ConditionalFormatType.topBottom)
  conditionalFormat.getTopBottom().getFormat().getFill().setColor("green");
  conditionalFormat.getTopBottom().setRule({
    rank: 10,
    type: ExcelScript.ConditionalTopBottomCriterionType.topPercent
  });
}


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