+ Reply to Thread
Results 1 to 2 of 2

Delete all named ranges with scopes different than Workbook

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,946

    Delete all named ranges with scopes different than Workbook

    Hi,

    i am looking for code to delete all named ranges with scope <> Workbook.

    Do you have maybe code with
    If TypeOf Parent Is Worksheet Then
    ?

    Best,
    Jacek

  2. #2
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,973

    Re: Delete all named ranges with scopes different than Workbook

    Something like below.

    Sub Demo()
    Dim nm As Name
    For Each nm In ThisWorkbook.Names
        If TypeName(nm.Parent) <> "Workbook" Then
            nm.Delete
        End If
    Next
    End Sub
    "Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something."
    ― Robert A. Heinlein

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] How to delete strange named ranges?
    By jaryszek in forum Excel General
    Replies: 17
    Last Post: 12-20-2018, 04:52 AM
  2. [SOLVED] Out of Memory when trying to delete named ranges
    By Groovicles in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 07-12-2018, 10:21 AM
  3. [SOLVED] Macro to delete 2 named ranges
    By bevc in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-30-2016, 02:37 AM
  4. [SOLVED] Delete all Named Ranges in another workbook
    By tejay in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 11-15-2015, 03:43 AM
  5. Duplicate Named Ranges, how to specify which one to delete
    By treygriffin in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-11-2013, 10:45 AM
  6. Delete named ranges from selection
    By AlvaroSiza in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-17-2012, 05:20 PM
  7. delete a bunch of named ranges
    By Takeadoe in forum Excel General
    Replies: 2
    Last Post: 06-30-2006, 07:35 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1