Link to home
Start Free TrialLog in
Avatar of Euro5
Euro5Flag for United States of America

asked on

vba remove all named ranges?

I have vba code to create named ranges dynamically.
I would like to have a code to remove these on each run, so the user doesn't have any legacy named ranges from the last run.

Can anyone help? Thanks so much!
ASKER CERTIFIED SOLUTION
Avatar of Saurabh Singh Teotia
Saurabh Singh Teotia
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Professor J
Professor J

here it is

Sub DeleteNamedRanges() 
     
    Dim nm              As Name 
     
    On Error Resume Next 
    For Each nm In ActiveWorkbook.Names 
        nm.Delete 
    Next 
    On Error Goto 0 
     
End Sub 

Open in new window

Jim,

I hope now i'm able to live upto my mark.. :-)

Saurabh...
Avatar of Euro5

ASKER

Thanks!
Yes,  your comment ID: 40811373 just did the work. and here you go Euro5 award the mark :-)