XL.Sheet.AddHyperlink
---------------------

Adds the new hyperlink.

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

MBS( "XL.Sheet.AddHyperlink"; BookRef; SheetIndex; HyperLink; rowFirst; rowLast; ColFirst; ColLast ) 

**MBS**( **"XL.Sheet.AddHyperlink";** /\* Adds the new hyperlink. \*/  
**$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 \*/   
**$HyperLink**; /\* The text for the hyperlink.e.g. "http://www.mbsplugins.de/" \*/   
**$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 |
| HyperLink | The text for the hyperlink. | "http://www.mbsplugins.de/" |
| 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

Adds the new hyperlink.  
### Examples

Add a link to cell B16:

 MBS ( "XL.Sheet.AddHyperlink"; $book ; $sheet ; "http://www.monkeybreadsoftware.com/"; 15; 15; 1; 1)  
Add a hyperlink to point to fmp URL:

 Set Variable \[ $r ; Value: MBS ( "XL.Sheet.AddHyperlink"; $book ; $sheet ; "FMP://~/Clients?script=ShowContact&amp;param=123456"; 10; 10; 1; 1)\]  
  
\# you can pass back a record ID to the script, so clicking on the Excel cell would jump you back to FileMaker.   
You can write text and add a hyperlink:

 Set Variable \[ $r ; Value: MBS ( "[XL.Sheet.CellWriteText](XLSheetCellWriteText.md)"; $BookRef ; $sheet ; 7; 1; "Link" ) \]  
Set Variable \[ $r ; Value: MBS ( "XL.Sheet.AddHyperlink"; $bookRef ; $sheet ; "http://www.monkeybreadsoftware.com/"; 7; 7; 1; 1) \]  
### See also

- [XL.Book.SheetCount](XLBookSheetCount.md)
- [XL.Sheet.CellWriteText](XLSheetCellWriteText.md)
- [XL.Sheet.DelHyperlink](XLSheetDelHyperlink.md)
- [XL.Sheet.Hyperlink](XLSheetHyperlink.md)

### Example Databases

- [XL/Edit Sheet](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/XL/Edit%20Sheet.shtml#1ScriptAnchor_)

This function checks for a license.

Created 18th August 2014 , last changed 12nd January 2025

  
[XL.Sheet.AddDataValidation](XLSheetAddDataValidation.md) - [XL.Sheet.AddIgnoredError](XLSheetAddIgnoredError.md)

[HTML Version](XLSheetAddHyperlink.shtml)