# Remove-OfficeExcelNamedRange

Removes a defined name. Review available syntax, parameters, pipeline guidance, and reference details in PSWriteOffice Cmdlet Reference.

Cmdlet 

**Module**

`PSWriteOffice`

**Inputs**

`OfficeIMO.Excel.ExcelDocument`

**Source**

[RemoveOfficeExcelNamedRangeCommand.cs:32](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/PowerShell/PSWriteOffice/Sources/PSWriteOffice/Cmdlets/Excel/RemoveOfficeExcelNamedRangeCommand.cs#L32) 

Removes a defined name.

## Syntax

```
Remove-OfficeExcelNamedRange
[-Document <ExcelDocument>]
[-Global]
[-Name] <String>
[-PassThru]
[-Sheet <OfficeSheetSelector>]
[<CommonParameters>]
```

[#](#method-remove-officeexcelnamedrange-exceldocument-switchparameter-string-switchparameter-officesheetselector)

Parameter set: `Default`

## Examples

### Remove a defined name

```powershell
Open-OfficeExcel -Path .\Finance\Budget-2027.xlsx {
    Remove-OfficeExcelNamedRange OldTaxRate
}
```

Deletes the OldTaxRate name from the workbook.

### Clean up names that no longer resolve

```powershell
$broken = Get-OfficeExcelNamedRange -Path .\Finance\Budget-2027.xlsx | Where-Object Reference -like '*#REF!*'
Open-OfficeExcel -Path .\Finance\Budget-2027.xlsx {
    foreach ($name in $broken) {
        Remove-OfficeExcelNamedRange -Name $name.Name
    }
}
```

Removes every defined name that points to #REF! and saves the workbook.

## Parameters

**-Document ExcelDocument optionalpipeline: True (ByValue)**

Caller-owned workbook; omission uses the enclosing Excel content block.

**-Global SwitchParameter optional**

Use workbook-global scope from inside the DSL.

**-Name String requiredposition: 0**

Named range name.

**-PassThru SwitchParameter optional**

Emits the native result after the operation.

**-Sheet OfficeSheetSelector optional**

Worksheet name, one-based position or native worksheet object. Multi-sheet commands also accept wildcard names.

## Common Parameters

This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.

For more information, see [about_CommonParameters](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters).

<!-- PowerForge markdown artifact sha256:5006E6E7C12C69596429FAC6EC355EE7EE4A9DA405072AE6102F5E2B53D60EA3 -->
