+ Reply to Thread
Results 1 to 6 of 6

Localisation of Range Names

  1. #1
    Chris Gorham
    Guest

    Localisation of Range Names

    Hi,

    I would like to "localise" range names using VBA code.

    Local range names (as I understand) are range names that are attached to the
    sheet name on which they reside - so you can have several of the same range
    names, but each one on a different sheet in the same workbook.

    These range names have the sheet name infront of them separated by a "!"

    e.g. sheet1!range1

    I could, of course, create a string from the individual components and then
    assign the address of cells represented by range1 to it - but it wouldn't be
    very neat....

    I just want to take range1 and localise it.

    Ideas...?? Thanks...Chris



  2. #2
    Peter T
    Guest

    Re: Localisation of Range Names

    Hi Chris,

    Code to do that would go something like this

    -loop names at workbook-level
    if InStr(nm.Name, "!") ignore, it's already a local name
    set rng = nm.RefersToRange
    if this succeeds (it's a range name), add a new similar name prefixed with
    apostrophe & rng.parent.name & apostrophe & ! & nm.name refersto rng
    (also having checked same local name doesn't already exist)
    delete the old name

    But -
    - there are loads of pitfalls
    - all the hard work has been done very well !

    Get hold of the NameManager addin which you can get from the authors' sites
    of Jan Karel Pieterse and Charles Williams (download sections).

    www.jkp-ads.com
    www.DecisionModels.com

    Regards,
    Peter T


    "Chris Gorham" <[email protected]> wrote in message
    news:[email protected]...
    > Hi,
    >
    > I would like to "localise" range names using VBA code.
    >
    > Local range names (as I understand) are range names that are attached to

    the
    > sheet name on which they reside - so you can have several of the same

    range
    > names, but each one on a different sheet in the same workbook.
    >
    > These range names have the sheet name infront of them separated by a "!"
    >
    > e.g. sheet1!range1
    >
    > I could, of course, create a string from the individual components and

    then
    > assign the address of cells represented by range1 to it - but it wouldn't

    be
    > very neat....
    >
    > I just want to take range1 and localise it.
    >
    > Ideas...?? Thanks...Chris
    >
    >




  3. #3
    Peter T
    Guest

    Re: Localisation of Range Names

    Hi Chris,

    Code to do that would go something like this

    -loop names at workbook-level
    if InStr(nm.Name, "!") ignore, it's already a local name
    set rng = nm.RefersToRange
    if this succeeds (it's a range name), add a new similar name prefixed with
    apostrophe & rng.parent.name & apostrophe & ! & nm.name refersto rng
    (also having checked same local name doesn't already exist)
    delete the old name

    But -
    - there are loads of pitfalls
    - all the hard work has been done very well !

    Get hold of the NameManager addin which you can get from the authors' sites
    of Jan Karel Pieterse and Charles Williams (download sections).

    www.jkp-ads.com
    www.DecisionModels.com

    Regards,
    Peter T


    "Chris Gorham" <[email protected]> wrote in message
    news:[email protected]...
    > Hi,
    >
    > I would like to "localise" range names using VBA code.
    >
    > Local range names (as I understand) are range names that are attached to

    the
    > sheet name on which they reside - so you can have several of the same

    range
    > names, but each one on a different sheet in the same workbook.
    >
    > These range names have the sheet name infront of them separated by a "!"
    >
    > e.g. sheet1!range1
    >
    > I could, of course, create a string from the individual components and

    then
    > assign the address of cells represented by range1 to it - but it wouldn't

    be
    > very neat....
    >
    > I just want to take range1 and localise it.
    >
    > Ideas...?? Thanks...Chris
    >
    >




  4. #4
    Chris Gorham
    Guest

    Re: Localisation of Range Names

    Thanks, I'll try this tomorrow....

    I'm writing my own Range Name Manager...feel free to check out my website
    www.mastertool.co.uk which contains all my add-ins...the linktracer is
    amazing...

    This version is the one currently being rewritten....

    Chris

    "Peter T" wrote:

    > Hi Chris,
    >
    > Code to do that would go something like this
    >
    > -loop names at workbook-level
    > if InStr(nm.Name, "!") ignore, it's already a local name
    > set rng = nm.RefersToRange
    > if this succeeds (it's a range name), add a new similar name prefixed with
    > apostrophe & rng.parent.name & apostrophe & ! & nm.name refersto rng
    > (also having checked same local name doesn't already exist)
    > delete the old name
    >
    > But -
    > - there are loads of pitfalls
    > - all the hard work has been done very well !
    >
    > Get hold of the NameManager addin which you can get from the authors' sites
    > of Jan Karel Pieterse and Charles Williams (download sections).
    >
    > www.jkp-ads.com
    > www.DecisionModels.com
    >
    > Regards,
    > Peter T
    >
    >
    > "Chris Gorham" <[email protected]> wrote in message
    > news:[email protected]...
    > > Hi,
    > >
    > > I would like to "localise" range names using VBA code.
    > >
    > > Local range names (as I understand) are range names that are attached to

    > the
    > > sheet name on which they reside - so you can have several of the same

    > range
    > > names, but each one on a different sheet in the same workbook.
    > >
    > > These range names have the sheet name infront of them separated by a "!"
    > >
    > > e.g. sheet1!range1
    > >
    > > I could, of course, create a string from the individual components and

    > then
    > > assign the address of cells represented by range1 to it - but it wouldn't

    > be
    > > very neat....
    > >
    > > I just want to take range1 and localise it.
    > >
    > > Ideas...?? Thanks...Chris
    > >
    > >

    >
    >
    >


  5. #5

    Re: Localisation of Range Names

    HI CHris,

    > I'm writing my own Range Name Manager...feel free to check out my website
    > www.mastertool.co.uk which contains all my add-ins...the linktracer is
    > amazing...


    I'll check it out!

    Regards,

    Jan Karel Pieterse
    Excel MVP
    JKP Application Development Services
    http://www.jkp-ads.com


  6. #6
    Chris Gorham
    Guest

    Re: Localisation of Range Names

    please feel free to do so...but note that I'm 70% through a major upgrade.

    I've looked at this localisation issue today...Peter's suggestion was really
    a better way of coding my idea...but he has indicated via email that there
    are problems ahead and indeed it appears that when a sheet name contains a
    character such as "!" then it falls over. This is because Excel for some
    reason starts putting the character ' at each end of the sheet name.

    I've circuimvented this by always changing the sheet name to a temporary one
    and then swopping it back...localisation then works fine using the code (or
    close to it) from Peter.

    Chris

    "[email protected]" wrote:

    > HI CHris,
    >
    > > I'm writing my own Range Name Manager...feel free to check out my website
    > > www.mastertool.co.uk which contains all my add-ins...the linktracer is
    > > amazing...

    >
    > I'll check it out!
    >
    > Regards,
    >
    > Jan Karel Pieterse
    > Excel MVP
    > JKP Application Development Services
    > http://www.jkp-ads.com
    >
    >


+ 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