XL.Sheet.SetCellFormats
-----------------------

Set cell formats in given area.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [XL](component_XL.md) | [8.0](newinversion80.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "XL.Sheet.SetCellFormats"; BookRef; SheetIndex; First row; Last row; First column; Last column; Formats { ; Row Delimiter; Column Delimiter } ) 

**MBS**( **"XL.Sheet.SetCellFormats";** /\* Set cell formats in given area. \*/  
**$BookRef**; /\* The reference number for the workbook.e.g. $ref \*/   
**$SheetIndex**; /\* The index of the sheet. This number ranges from 0 to [XL.Book.SheetCount](XLBookSheetCount.md)-1.e.g. 0 \*/   
**$First row**; /\* The first row to process. First row has index 0.e.g. 3 \*/   
**$Last row**; /\* The last row to process. First row has index 0.e.g. 6 \*/   
**$First column**; /\* The first column to process. First column has index 0.e.g. 2 \*/   
**$Last column**; /\* The last column to process. First column has index 0.e.g. 4 \*/   
**$Formats**; /\* The format to use.  
Can be separated with row and column delimiter to give each row and column a different format.  
But you can also use same format for all rows or for all columns.e.g. $dollarFormat \*/   
**$Row Delimiter**; /\* Optional; The row delimiter for the result.  
Default is new line character.e.g. "¶" \*/   
**$Column Delimiter**) /\* Optional; The column delimiter for the result.  
Default is tab character.e.g. char(9) \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| BookRef | The reference number for the workbook. | $ref |  |
| SheetIndex | The index of the sheet. This number ranges from 0 to [XL.Book.SheetCount](XLBookSheetCount.md)-1. | 0 |  |
| First row | The first row to process. First row has index 0. | 3 |  |
| Last row | The last row to process. First row has index 0. | 6 |  |
| First column | The first column to process. First column has index 0. | 2 |  |
| Last column | The last column to process. First column has index 0. | 4 |  |
| Formats | The format to use.   Can be separated with row and column delimiter to give each row and column a different format.   But you can also use same format for all rows or for all columns. | $dollarFormat |  |
| Row Delimiter | The row delimiter for the result.   Default is new line character. | "¶" | Optional |
| Column Delimiter | The column delimiter for the result.   Default is tab character. | char(9) | Optional |

### Result

Returns number of errors or error.

### Description

Set cell formats in given area.  
### Examples

Write bold row and data rows:

 # create bold font &amp; format   
Set Variable \[ $boldFont ; Value: MBS ( "[XL.Book.AddFont](XLBookAddFont.md)"; $bookRef ) \]   
Set Variable \[ $r ; Value: MBS ( "[XL.Font.SetBold](XLFontSetBold.md)"; $bookRef ; $boldFont ; 1) \]   
Set Variable \[ $boldFormat ; Value: MBS ( "[XL.Book.AddFormat](XLBookAddFormat.md)"; $bookRef ) \]   
Set Variable \[ $r ; Value: MBS ( "[XL.Format.SetFont](XLFormatSetFont.md)"; $bookRef ; $boldFormat ; $boldFont ) \]   
\# Write a title row   
Set Variable \[ $r ; Value: MBS ( "[XL.Sheet.CellWriteTexts](XLSheetCellWriteTexts.md)"; $bookRef ; $sheet ; 1; 1; 1; 4; "A,B,C,D"; ¶; "," ) \]   
\# Make it bold   
Set Variable \[ $r ; Value: MBS ( "XL.Sheet.SetCellFormats"; $bookRef ; $sheet ; 1; 1; 1; 4; $boldFormat ) \]   
\# and write data   
Set Variable \[ $r ; Value: MBS ( "[XL.Sheet.CellWriteTexts](XLSheetCellWriteTexts.md)"; $bookRef ; $sheet ; 2; 5; 1; 4; $data ; ¶; "," ) \]  
Set a range of cells to same format:

 MBS ( "XL.Sheet.SetCellFormats"; $BookRef ; $sheet ; 1; 3; 7; 10; $dollarFormat )  
### See also

- [XL.Book.AddFont](XLBookAddFont.md)
- [XL.Book.SheetCount](XLBookSheetCount.md)
- [XL.Font.SetBold](XLFontSetBold.md)
- [XL.Format.SetFont](XLFormatSetFont.md)
- [XL.Sheet.CellWriteMatrix](XLSheetCellWriteMatrix.md)
- [XL.Sheet.CellWriteText](XLSheetCellWriteText.md)
- [XL.Sheet.CellWriteTexts](XLSheetCellWriteTexts.md)
- [XL.Sheet.GetCellErrors](XLSheetGetCellErrors.md)
- [XL.Sheet.GetCellFormats](XLSheetGetCellFormats.md)
- [XL.Sheet.SetCellFormat](XLSheetSetCellFormat.md)

### Release notes

- **Version 8.0**
    - Added [XL.Sheet.CellReadBooleans](http://www.mbsplugins.eu/XLSheetCellReadBooleans.shtml), [XL.Sheet.CellReadComments](http://www.mbsplugins.eu/XLSheetCellReadComments.shtml), [XL.Sheet.CellReadDates](http://www.mbsplugins.eu/XLSheetCellReadDates.shtml), [XL.Sheet.CellReadFormulas](http://www.mbsplugins.eu/XLSheetCellReadFormulas.shtml), [XL.Sheet.CellReadNumbers](http://www.mbsplugins.eu/XLSheetCellReadNumbers.shtml), [XL.Sheet.CellReadTexts](http://www.mbsplugins.eu/XLSheetCellReadTexts.shtml), [XL.Sheet.CellWriteBlanks](http://www.mbsplugins.eu/XLSheetCellWriteBlanks.shtml), [XL.Sheet.CellWriteBooleans](http://www.mbsplugins.eu/XLSheetCellWriteBooleans.shtml), [XL.Sheet.CellWriteComments](http://www.mbsplugins.eu/XLSheetCellWriteComments.shtml), [XL.Sheet.CellWriteDates](http://www.mbsplugins.eu/XLSheetCellWriteDates.shtml), [XL.Sheet.CellWriteFormulas](http://www.mbsplugins.eu/XLSheetCellWriteFormulas.shtml), [XL.Sheet.CellWriteNumbers](http://www.mbsplugins.eu/XLSheetCellWriteNumbers.shtml), [XL.Sheet.CellWriteTexts](http://www.mbsplugins.eu/XLSheetCellWriteTexts.shtml), [XL.Sheet.GetCellErrors](http://www.mbsplugins.eu/XLSheetGetCellErrors.shtml), [XL.Sheet.GetCellFormats](http://www.mbsplugins.eu/XLSheetGetCellFormats.shtml), [XL.Sheet.RemoveComments](http://www.mbsplugins.eu/XLSheetRemoveComments.shtml) and [XL.Sheet.SetCellFormats](http://www.mbsplugins.eu/XLSheetSetCellFormats.shtml).

### Blog Entries

- [MBS FileMaker Plugin, version 8.0pr8](https://www.mbsplugins.de/archive/2018-01-15/MBS_FileMaker_Plugin_version_8/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 15th January 2018 , last changed 29th January 2023

  
[XL.Sheet.SetCellFormat](XLSheetSetCellFormat.md) - [XL.Sheet.SetCol](XLSheetSetCol.md)

[HTML Version](XLSheetSetCellFormats.shtml)