Defines a new name. Restituisce an
IXLSName Interface
Sintassi
funzione Add(Name: Widestring; RefersTo: Widestring):
IXLSName;
funzione Add(Name: Widestring; RefersTo: Widestring; Visible: boolean):
IXLSName;
funzione Add(Name: Widestring; SheetName: Widestring; Row: Integer; Col: Integer):
IXLSName;
funzione Add(Name: Widestring; SheetName: Widestring; Row1: Integer; Col1: Integer; Row2: Integer; Col2: Integer):
IXLSName;
| Name |
Required Widestring. The text to use as the name. Names cannot include spaces e cannot look like cell references |
| RefersTo |
Widestring obbligatorio. Descrive a cosa si riferisce il nome (usando la notazione in stile A1) |
| Visible |
Optional Boolean. True to define the name normally. False to define the name as a hidden name (that is, it doesn't appear in either the Define Name, Paste Name, o Goto dialog box). The default value is True |
| SheetName |
Required Widestring. The worksheet that owns the target cell o range |
| Row |
Required Integer. The one-based row for a single-cell target |
| Col |
Required Integer. The one-based column for a single-cell target |
| Row1, Col1, Row2, Col2 |
Required Integers. The one-based row e column coordinates for a rectangular target range |
Esempio
This example adds new defined name for the Workbook e use this name in the cell Formula
Workbook.Names.Add('MyName','=Sheet1!$F$10:$H$20');
Workbook.Sheets[1].Cells[3,4].Formula := '=SUM(MyName)';
This example creates single-cell e range names from worksheet coordinates
Workbook.Names.Add('InputCell','Sheet1',2,3);
Workbook.Names.Add('InputBlock','Sheet1',4,2,6,5);
This example adds new defined name for the Worksheet one e use this name in the cell Formula
Workbook.Sheets[1].Names.Add('MyName','=Sheet1!$F$10:$H$20');
Workbook.Sheets[2].Cells[3,4].Formula := '=SUM(Sheet1!MyName)';
Vedere also