ExcelScript.BuiltInStyle enum
Remarks
Examples
/**
* This script sets the cell style to "warning text"
* on every cell with a formula error.
*/
function main(workbook: ExcelScript.Workbook) {
// Get the used range in the current worksheet.
const sheet = workbook.getActiveWorksheet();
const usedRange = sheet.getUsedRange();
// Get any cells that are displaying errors.
const errorCells = usedRange.getSpecialCells(
ExcelScript.SpecialCellType.formulas,
ExcelScript.SpecialCellValueType.errors
);
// Check if there are error cells before proceeding.
if (errorCells) {
// Use the built-in warning text style on the error cells.
errorCells.setPredefinedCellStyle(
ExcelScript.BuiltInStyle.warningText.toString()
);
} else {
console.log("No formula errors in the worksheet.");
}
}
Fields
accent1 | |
accent1_20 | |
accent1_40 | |
accent1_60 | |
accent2 | |
accent2_20 | |
accent2_40 | |
accent2_60 | |
accent3 | |
accent3_20 | |
accent3_40 | |
accent3_60 | |
accent4 | |
accent4_20 | |
accent4_40 | |
accent4_60 | |
accent5 | |
accent5_20 | |
accent5_40 | |
accent5_60 | |
accent6 | |
accent6_20 | |
accent6_40 | |
accent6_60 | |
bad | |
calculation | |
checkCell | |
comma | |
currency | |
emphasis1 | |
emphasis2 | |
emphasis3 | |
explanatoryText | |
good | |
heading1 | |
heading2 | |
heading3 | |
heading4 | |
hlink | |
hlinkTrav | |
input | |
linkedCell | |
neutral | |
normal | |
note | |
output | |
percent | |
sheetTitle | |
total | |
warningText | |
wholeComma | |
wholeDollar |
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.
Office Scripts