Wiki Markup |
---|
{description} {excerpt}Creates a named range from a specified formula. A range is a collection of areas; an area is a rectangular collection of cells. This method can be used to create a non\-rectangular range containing multiple rectangular areas.{excerpt} {signature:C#} public Range CreateNamedRange(System.String rangeFormula, System.String rangeName) {signature}{signature:vb.net} Public Function CreateNamedRange(ByVal rangeFormula As String, ByVal rangeName As String) As Range {signature} {parameters} {param:rangeFormula}Formula representing the range, for example "=Sheet1\!A1:G10". The formula must be three\-dimensional \(specify a sheet\), and can include only sheet and cell references, and operators joining those references \(range ':', intersection ' ', and union ','\).{param} {param:rangeName}The name of the new range.{param} {returns}A [Range|Range] object.{returns} {remarks} Note that if a range named {{rangeName}} already exists in the worksheet, it will be overwritten with the new named range created by this method. {remarks} {example}{code:csharp|title=C#} Range rng = ws.CreateRange("=Sheet1!$B$12:$H$21 Sheet1!$F$18:$K$29", "Range1"); {code} {code:vb.net|title=vb.net} Dim rng As Range = _ ws.CreateRange("=Sheet1!$B$12:$H$21 Sheet1!$F$18:$K$29", "Range1") {code} {example} |
Page History
Overview
Content Tools