Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delete Multiple Named Ranges 1

Status
Not open for further replies.

binaryfingers

Technical User
Jul 26, 2002
118
Hi

I have a sheet that has over 100 named ranges on it. I would like to delete them all. However the only way I can find is selecting them 1 by 1 and hit delete. As you can appreciate, takes a while..

I dont know VBA code, so any help?

Thanks,
 

Hi,
Code:
sub DeleteAllNamesInWorkbook()
  dim n as name
  for each n in activeworkbook.names
    n.delete
  next
end sub
alt+F11 activates the VB Editor

cnt+R view the Project

right click and select Insert module

Paste code into Module

Run the code.

Skip,

[glasses] [red]Be Advised![/red] For those this winter, caught in Arctic-like calamity, be consoled...
Many are cold, but few are frozen![tongue]
 
Excellent! Thanks for the FAST response and the detailed answer!
 
Just for info, there is a way to do it without VBA which i cribbed a while ago from an old post of Norman Harker's in the MS newsgroups:-

Simplest way is to use an old Lotus keystroke command that works in Excel but which doesn't have an equivalent without VBA.

Tools > Options > Transition
Select the Lotus 1-2-3 Help option

Thereafter:

/RNR

Will clear all of your names including those set by Excel such as Print_Area.

But watch out. There's no, "Are you sure!" And there's no Undo capability. But if this is what you want, it sure beats doing it one at a time.

Regards
Ken..............

----------------------------------------------------------------------------
[peace]It's easier to beg forgiveness than ask permission[2thumbsup]
----------------------------------------------------------------------------
 
Thanks Ken, I must be missing something as I cant find that option under options and transition
 
If you are in 2003 then I'm afraid it has disappeared. It's there in XP.

Regards
Ken.............

----------------------------------------------------------------------------
[peace]It's easier to beg forgiveness than ask permission[2thumbsup]
----------------------------------------------------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top