Clear Named Ranges

L

Les Stout

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 ***
 
G

Gary''s Student

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
 
B

Bob Phillips

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top