XL.Sheet.AutoFilter.SetRef
--------------------------

Sets the cell range of AutoFilter with header.

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

MBS( "XL.Sheet.AutoFilter.SetRef"; BookRef; SheetIndex; rowFirst; rowLast; ColFirst; ColLast ) 

**MBS**( **"XL.Sheet.AutoFilter.SetRef";** /\* Sets the cell range of AutoFilter with header. \*/  
**$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 \*/   
**$ColFirst**; /\* The first column for the area. First column has index 0.e.g. $column \*/   
**$ColLast**) /\* The last column for the area. First column has index 0.e.g. $column+1 \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| 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 |
| ColFirst | The first column for the area. First column has index 0. | $column |
| ColLast | The last column for the area. First column has index 0. | $column+1 |

### Result

Returns OK or error.

### Description

Sets the cell range of AutoFilter with header.  
### Examples

Set area:

 Set Variable \[ $r ; Value: MBS ( "[XL.Sheet.AutoFilter](XLSheetAutoFilter.md).SetRef"; $book ; $sheet ; 2; 10; 1; 4) \]  
### See also

- [XL.Book.SheetCount](XLBookSheetCount.md)
- [XL.Sheet.AutoFilter](XLSheetAutoFilter.md)
- [XL.Sheet.AutoFilter.AddSort](XLSheetAutoFilterAddSort.md)
- [XL.Sheet.AutoFilter.Clear](XLSheetAutoFilterClear.md)
- [XL.Sheet.AutoFilter.GetRef](XLSheetAutoFilterGetRef.md)
- [XL.Sheet.AutoFilter.GetSort](XLSheetAutoFilterGetSort.md)
- [XL.Sheet.AutoFilter.GetSortEx](XLSheetAutoFilterGetSortEx.md)
- [XL.Sheet.AutoFilter.GetTop10](XLSheetAutoFilterGetTop10.md)
- [XL.Sheet.AutoFilter.SetSort](XLSheetAutoFilterSetSort.md)
- [XL.Sheet.AutoFilter.SetTop10](XLSheetAutoFilterSetTop10.md)

This function checks for a license.

Created 22nd April 2017 , last changed 1st July 2017

  
[XL.Sheet.AutoFilter.SetCustomFilter](XLSheetAutoFilterSetCustomFilter.md) - [XL.Sheet.AutoFilter.SetSort](XLSheetAutoFilterSetSort.md)

[HTML Version](XLSheetAutoFilterSetRef.shtml)