Quick name deletion line required

  • Thread starter Thread starter Jack Sheet
  • Start date Start date
J

Jack Sheet

Hi all

With Application.ThisWorkbook

'Line required here that does the following:
'Delete all names in ThisWorkbook that have
'the string "Global" contained within the name
'but which are NOT global names, ie
'which are local to a worksheet

End With 'Application.ThisWorkbook

Sorry, folks, I know it should be trivial but I got stuck.
 
Hi Jack,
'Line required here that does the following:
'Delete all names in ThisWorkbook that have
'the string "Global" contained within the name
'but which are NOT global names, ie
'which are local to a worksheet

Ah, those names <g>

Sub RemoveNamesWithGlobal(oWkbk as Workbook)
Dim oNm as Name
For Each Onm in oWkbk.Names
If Instr("Global",Onm.Name)>0 And Instr("!",oNm.Name)=0 Then
Onm.Delete
End If
Next
End Sub

Of course this can be combined with the other one I gave you.

Regards,

Jan Karel Pieterse
Excel MVP
www.jkp-ads.com
 

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

Back
Top