Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Macro to remove all names from workbook

I've inherited a workbook that is littered with literally hundreds of named ranges unecessarily and its causing problems when moving a sheet from one workbook to another. Because i can't select more than one name at once in the insert | name | define box, its taking me an eon to delete them individually.

Any suggestions for a macro to do this?

TIA ;)
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 64
Default Macro to remove all names from workbook

Katherine,

this quick macro should get rid of them for you:

Sub DeleteAllNames()

Dim Nm As Name

For Each Nm In ActiveWorkbook.Names
Nm.Delete
Next Nm

End Sub

'Cheers, Pete.

-----Original Message-----
I've inherited a workbook that is littered with literally

hundreds of named ranges unecessarily and its causing
problems when moving a sheet from one workbook to another.
Because i can't select more than one name at once in the
insert | name | define box, its taking me an eon to delete
them individually.

Any suggestions for a macro to do this?

TIA ;)
.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro to remove all names from workbook

Hi
try this

Sub delete_all_names()
errs = ""
For n = ActiveWorkbook.Names.Count To 1 Step -1
On Error Resume Next
ActiveWorkbook.Names(n).Delete
If Error < "" Then errs = errs & Chr(13)
ActiveWorkbook.Names(n).Name
Next
If errs < "" Then MsgBox "These names could not be deleted:" & errs

End Su

--
Message posted from http://www.ExcelForum.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 244
Default Macro to remove all names from workbook

This will do the job

Public Sub RemoveRngNms(
Dim cnt As Singl
On Error Resume Nex
cnt = ActiveWorkbook.Names.Coun
If cnt = 0 Then Exit Su
Do While ActiveWorkbook.Names.Count
ActiveWorkbook.Names(1).Delet
Loo
End Su


----- Katherine wrote: ----

I've inherited a workbook that is littered with literally hundreds of named ranges unecessarily and its causing problems when moving a sheet from one workbook to another. Because i can't select more than one name at once in the insert | name | define box, its taking me an eon to delete them individually.

Any suggestions for a macro to do this?

TIA ;)
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,979
Default Macro to remove all names from workbook

You can also download the Name Manager, a free add-in that makes it easy
to work with defined names:

http://www.bmsltd.ie/MVP/Default.htm

under the heading for Jan Karel Pieterse


Katherine wrote:
I've inherited a workbook that is littered with literally hundreds of named ranges unecessarily and its causing problems when moving a sheet from one workbook to another. Because i can't select more than one name at once in the insert | name | define box, its taking me an eon to delete them individually.

Any suggestions for a macro to do this?

TIA ;)



--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Filter and/or remove Names bronxbabe Setting up and Configuration of Excel 2 October 19th 09 09:38 AM
How to Remove dup names and if same rate. CYNTHIA Excel Discussion (Misc queries) 3 August 30th 07 02:01 PM
Remove Names from .xls Bharath Rajamani Excel Discussion (Misc queries) 5 July 28th 06 01:56 PM
Run macro to find names on seperate workbook, then add info from t Tim Excel Discussion (Misc queries) 1 March 22nd 06 03:47 PM
how do I find names in a workbook full of names aj Excel Discussion (Misc queries) 1 January 19th 06 09:01 PM


All times are GMT +1. The time now is 05:51 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"