Skip to content

applyxf

Apply a cell style (named or property-pair) to a range.

applyxf(cr, style_name)
applyxf(cr, prop1, val1, prop2, val2, ...)

Applies a cell style to the cells in cr. The style can be:

  • A named style from the workbook’s style gallery (e.g. 'Heading 1', 'Currency')
  • A set of name-value property pairs for a custom style — properties include 'BackgroundColor', 'Font', 'FontSize', 'Bold', 'Italic', 'NumberFormat', 'HorizontalAlignment', etc.

The abbreviation xf follows the OpenXML “cellXfs” terminology — extended formatting record.

applyxf(A1:A10, 'Heading 1')
applyxf(B2:D10, 'BackgroundColor', '#FFFF99', 'Bold', true)
  • applycxf — Apply conditional formatting to a range.
  • removecxf — Remove all conditional formatting from a range.