ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Delete all Range Names Except for 1 Q (https://www.excelbanter.com/excel-programming/381268-delete-all-range-names-except-1-q.html)

Sean

Delete all Range Names Except for 1 Q
 
I have the following code which deletes all Range Names in a Workbook.
How would I delete all except for 1 Range Name called "MyUsers"

For Each nName In ActiveWorkbook.Names
nName.Delete
Next


Thanks


Jon Peltier

Delete all Range Names Except for 1 Q
 
For Each nName In ActiveWorkbook.Names
If nName.Name < "MyUsers" Then
nName.Delete
End If
Next

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
http://PeltierTech.com
_______


"Sean" wrote in message
oups.com...
I have the following code which deletes all Range Names in a Workbook.
How would I delete all except for 1 Range Name called "MyUsers"

For Each nName In ActiveWorkbook.Names
nName.Delete
Next


Thanks




Sean

Delete all Range Names Except for 1 Q
 
Thanks Jon

Jon Peltier wrote:
For Each nName In ActiveWorkbook.Names
If nName.Name < "MyUsers" Then
nName.Delete
End If
Next

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
http://PeltierTech.com
_______


"Sean" wrote in message
oups.com...
I have the following code which deletes all Range Names in a Workbook.
How would I delete all except for 1 Range Name called "MyUsers"

For Each nName In ActiveWorkbook.Names
nName.Delete
Next


Thanks




All times are GMT +1. The time now is 05:27 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com