Calc Guide
a range named Scores, and then I used the following equation:
=SUM(Scores). To create a named range, select the range to define.
Use Insert > Names > Define to open the Define Names dialog. Use
the Define Names dialog to add and modify one named range at a time.
Figure 304. Define a named range.
In a macro, a named range is accessed, created, and deleted using the
NamedRanges property of a Calc document. Use the methods
hasByName(name) and getByName(name) to verify and retrieve a
named range. The method getElementNames() returns an array
containing the names of all named ranges. The NamedRanges object
supports the method addNewByname, which accepts four arguments;
the name, content, position, and type. The macro in Listing 10 creates
a named range, if it does not exist, that references a range of cells.
Listing 10. Create a named range that references $Sheet1.$B$3:$D$6.
Sub AddNamedRange()
Dim oRange ' The created range.
Dim oRanges ' All named ranges.
Dim sName$ ' Name of the named range to create.
Dim oCell ' Cell object.
Dim s$
sName$ = "MyNRange"
oRanges = ThisComponent.NamedRanges
360 OpenOffice.org 3.x Calc Guide