ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Quick name deletion line required (https://www.excelbanter.com/excel-programming/318174-quick-name-deletion-line-required.html)

Jack Sheet

Quick name deletion line required
 
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.

--
Return email address is not as DEEP as it appears



Jan Karel Pieterse

Quick name deletion line required
 
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



All times are GMT +1. The time now is 06:04 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com