< Back

Add-ExcelName

Wed Jan 15, 2020 12:15 am

NAME Add-ExcelName



SYNOPSIS

Adds a named-range to an existing Excel worksheet.





SYNTAX

Add-ExcelName [-Range] <ExcelRange> [[-RangeName] <String>] [<CommonParameters>]





DESCRIPTION

It is often helpful to be able to refer to sets of cells with a name rather than using their co-ordinates;

Add-ExcelName sets up these names.





PARAMETERS

-Range <ExcelRange>

The range of cells to assign as a name.



Required? true

Position? 1

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-RangeName <String>

The name to assign to the range. If the name exists it will be updated to the new range. If no name is

specified, the first cell in the range will be used as the name.



Required? false

Position? 2

Default value None

Accept pipeline input? False

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS



NOTES









-------------------------- EXAMPLE 1 --------------------------



PS\\> Add-ExcelName -Range $ws.Cells[$dataRange] -RangeName $rangeName



$WS is a worksheet, and $dataRange is a string describing a range of cells - for example "A1:Z10" - which will

become a named range, using the name in $rangeName.



RELATED LINKS