+ Reply to Thread
Results 1 to 4 of 4

How do I apply globally defined names to newly inserted templates?

  1. #1
    Registered User
    Join Date
    09-07-2012
    Location
    Munich
    MS-Off Ver
    Excel 2010
    Posts
    3

    How do I apply globally defined names to newly inserted templates?

    Hi,

    I have got a problem: I have got a workbook with several sheets and globally defined names (scope = workbook). Further, I have extracted two templates out of that workbook (type-format .xltm) that contain locally defined names. These templates carry references to those names defined in the workbook. Now, I want to insert the templates several times, using VBA. It works.
    However, after the insert, all the globally defined names exist in each inserted sheet as locally defined names, too, which leads to conflicts. I don't mean that! Unfortunately, these now locally defined names might carry outdated references (because the range of the original globally defined name in the workbook has changed, e.g.) and as the scope of the local ones is smaller they will be preferred by Excel.
    I tried to solve this problem by deleting all globally defined names in the templates. Now, after the insert, the globally defined names exist only once and without any conflict. And: the inserted sheets partly recognize those global names.
    What does "partly" mean? When I have a look at the dropdown menu on the left hand side of the "fx" field (between the menus and the actual sheet), I see all the global names. However, none of the cells that contain references to these names work correctly. They all show a #NAME error. The "funny" thing is: I can fix that very easily by hand. All I had to do is to select each cell with a formula that references one of the globally defined names, select this formula and then press enter. If I do that, the error is gone and the cells work correctly. However, this is obviously no option for me: to select every cell manually just to press enter. I would like to advise the newly inserted templates to automatically accept the existing names.

    EDIT: I have tried Application.Calculate - didn't change anything.

    Could you help me? Any other solution strategies? Thanks in advance :-)

    I am using Excel 2010 and Win 7.

    All the best - Manzomanen
    Last edited by Manzomanen; 10-12-2012 at 11:12 AM.

  2. #2
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,841

    Re: How do I apply globally defined names to newly inserted templates?

    Interesting problem. I have no solution right now, I am just about to leave. If you are working with this manually as well I can recommend this improved Name Manager. It can convert globals to locals and so on.
    http://www.jkp-ads.com/officemarketplacenm-en.asp
    <----- If you were helped by my posts you can say "Thank you" by clicking the star symbol down to the left

    If the problem is solved, finish of the thread by clicking SOLVED under Thread Tools
    I don't wish to leave you with no answer, yet I sometimes miss posts. If you feel I forgot you, remind me with a PM or just bump the thread.

  3. #3
    Registered User
    Join Date
    09-07-2012
    Location
    Munich
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: How do I apply globally defined names to newly inserted templates?

    Thanks Jacc, I will try the tool out next week, I'm about to leave, too :-)

    However, if somebody could still provide me an automated solution I would appreciate it.

  4. #4
    Registered User
    Join Date
    09-07-2012
    Location
    Munich
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: How do I apply globally defined names to newly inserted templates?

    I have now tried out your recommended tool. And it helped me, thanks! When I had all the duplicate names (global & local ones, i.e. before deleting all globally defined names in my templates), I could delete the "wrong" duplicates (i.e., the local ones) with the tool and instead, the inserted sheets recognized the globally defined names only.

    Now I have written the following code to do this work automatically:
    Please Login or Register  to view this content.
    However, I didn't find a way (didn't further look for it, though), to "activate" the globally defined names in my newly inserted templates if I had deleted those global names from my templates before.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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