+ Reply to Thread
Results 1 to 4 of 4

How to Delete ALL Defined Names in a WorkBook Dynamically created from a Single Sheet

  1. #1
    Registered User
    Join Date
    11-03-2008
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    2,522

    How to Delete ALL Defined Names in a WorkBook Dynamically created from a Single Sheet

    How to Delete ALL Defined Names in a WorkBook Dynamically created from a Single Sheet?

    I am creating some Files or WorkBooks Dynamically everything is fine however the purpose of creating this is to just have the Data BacK up with only Values and Formatting and No Formulas...

    But after checking the New WorKBook it has all the Defined Names from the Parent MasterSheet..

    IS is t possible to delete ALL the Defines Names when it is being created ?

    While GOOGLING on this issue I found some code which I tried in vain..
    http://www.ozgrid.com/forum/showthre...t=20268&page=1

    Richie's Code

    Sub RemoveNames()
    Dim nm As Name
    Dim NewWkBkName As String ' My New Line
    NewWkBkName = Sheets("PassBook").Range("U5").Value ' My New Line

    For Each nm In NewWkBkName.Names 'ThisWorkbook.Names
    nm.Delete
    Next nm
    End Sub
    Just to explain where Im going wrong Im enclosing it in Quotes..please excuse..!

    I am unable to attach a WorkBook as the file contains all confidential information so please pardon me for the same.

    Warm Regards
    e4excel
    Last edited by e4excel; 04-17-2011 at 03:26 AM.

  2. #2
    Registered User
    Join Date
    11-03-2008
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    2,522

    Re: How to Delete ALL Defined Names in a WorkBook Dynamically created from a Single S

    The problem is I cannot use

    ThisWOrkBook as it deletes the Names from the Parent Workbook as we still are in it

    So is there a way of doing it from the Parent WorkBook without deleting the Names in it..

  3. #3
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: How to Delete ALL Defined Names in a WorkBook Dynamically created from a Single S

    Try
    Please Login or Register  to view this content.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  4. #4
    Registered User
    Join Date
    11-03-2008
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    2,522

    Re: How to Delete ALL Defined Names in a WorkBook Dynamically created from a Single S

    Thanks Mike it worked well..

    I had also got it working but I was adding the code in the loop unnecessarily using the concept of Active WorkBook but this was irrespective of that..

    I knew what I wanted but dint know the Syntax as I am not well-versed with VBA..

    Warm Regards
    e4excel

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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