XL.Sheet.InsertRow
------------------

Inserts rows from rowFirst to rowLast.

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

MBS( "XL.Sheet.InsertRow"; BookRef; SheetIndex; rowFirst; rowLast { ; KeepRanges } ) 

**MBS**( **"XL.Sheet.InsertRow";** /\* Inserts rows from rowFirst to rowLast. \*/  
**$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 \*/   
**$rowFirst**; /\* The first row for the area. First row has index 0.e.g. $row \*/   
**$rowLast**; /\* The last row for the area. First row has index 0.e.g. $row \*/   
**$KeepRanges**) /\* Optional; If 1, the ranges are kept and not updated.  
Default is 0 to update ranges.e.g. 0 \*/ 

### 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 |  |
| rowFirst | The first row for the area. First row has index 0. | $row |  |
| rowLast | The last row for the area. First row has index 0. | $row |  |
| KeepRanges | If 1, the ranges are kept and not updated.   Default is 0 to update ranges. | 0 | Optional      Added in version **10.2**. |

### Result

Returns OK or error.

### Description

Inserts rows from rowFirst to rowLast.   
You may need to manually update formulas in the document if needed.   
### See also

- [XL.Book.SheetCount](XLBookSheetCount.md)
- [XL.Sheet.InsertCol](XLSheetInsertCol.md)
- [XL.Sheet.SetRow](XLSheetSetRow.md)

This function checks for a license.

Created 18th August 2014 , last changed 29th August 2023

  
[XL.Sheet.InsertCol](XLSheetInsertCol.md) - [XL.Sheet.IsAutoFilter](XLSheetIsAutoFilter.md)

[HTML Version](XLSheetInsertRow.shtml)