Names Delete

ayazgreat

Well-known Member
Joined
Jan 19, 2008
Messages
1,151
Hi

can anyone please tell me how to delete all dynamic names in one time, I have recorded mentioned below a macro can it be concise ?

HTML:
    ActiveWorkbook.Names("a").Delete
    ActiveWorkbook.Names("bt").Delete
    ActiveWorkbook.Names("c").Delete
    ActiveWorkbook.Names("d").Delete
    ActiveWorkbook.Names("e").Delete
    ActiveWorkbook.Names("f").Delete
    ActiveWorkbook.Names("h").Delete
    ActiveWorkbook.Names("i").Delete

Thanks in advance
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Sir
Thanks for your reply but could you please tell me one thing that your mentioned thread's code I tried to use and if I have got 20 dynamic names range said codes give me 20 time message to click, is this a better way to click 20 times ?
 
Upvote 0
Code:
Sub NAMED_RANGES()
Dim nr As Name
Application.DisplayAlerts = False
For Each nr In ActiveWorkbook.Names
    nr.delete
Next nr
Application.DisplayAlerts = True
End Sub
 
Upvote 0
Sir Vog
I am using mentioned below codes for it.

Sir lasw10 thank you very much your given codes work perfect.


HTML:
Sub Delete_My_Named_Ranges()
   Dim n As Name
   Dim Sht As String
   On Error GoTo err_check
   ' Put in name of sheet where the range is located
   Sht = "Org Lookups"
   For Each n In ThisWorkbook.Names
      If n.RefersToRange.Worksheet.Name = Sht Then n.Delete
   Next n
   
Exit Sub
err_check:
   MsgBox "Name: " & n.Name & vbCrLf & "RefersTo: " & n.RefersTo & vbCrLf & "caused an error"
   Resume Next
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,553
Messages
6,120,182
Members
448,948
Latest member
spamiki

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top