ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Clear Named Ranges (https://www.excelbanter.com/excel-programming/384745-clear-named-ranges.html)

Les Stout[_2_]

Clear Named Ranges
 
Hi All, I have a number of named ranges on a spread sheet and need to
clear their values on exiting the spread sheet. Is it possible to "Clear
all" ??

Les Stout

*** Sent via Developersdex http://www.developersdex.com ***

Gary''s Student

Clear Named Ranges
 
Sub clearum()
Dim n As Name
For Each n In ActiveWorkbook.Names
Range(n).Clear
Next
End Sub


Note that the Name is really a string and therefore appears in the RANGE()
argument
--
Gary''s Student
gsnu200709


"Les Stout" wrote:

Hi All, I have a number of named ranges on a spread sheet and need to
clear their values on exiting the spread sheet. Is it possible to "Clear
all" ??

Les Stout

*** Sent via Developersdex http://www.developersdex.com ***


Bob Phillips

Clear Named Ranges
 
Via a loop.

Dim nme As Name

For Each nme In ThisWorkbook.Names
If Not nme.Name Like "*_FilterDatabase" And _
Not nme.Name Like "*Print_Area" And _
Not nme.Name Like "*Print_Titles" And _
Not nme.Name Like "*wvu.*" And _
Not nme.Name Like "*wrn.*" And _
Not nme.Name Like "*!Criteria" Then
nme.Delete
End If
Next nme


--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Les Stout" wrote in message
...
Hi All, I have a number of named ranges on a spread sheet and need to
clear their values on exiting the spread sheet. Is it possible to "Clear
all" ??

Les Stout

*** Sent via Developersdex http://www.developersdex.com ***




Les Stout[_2_]

Clear Named Ranges
 
Thanks very much for the input and code Gary's Student, much
appreciated... (I'm getting there):)

Les Stout

*** Sent via Developersdex http://www.developersdex.com ***


All times are GMT +1. The time now is 12:53 PM.

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