Consulting

Results 1 to 2 of 2

Thread: Locking the name of a range

  1. #1
    VBAX Newbie
    Joined
    Sep 2011
    Location
    Orange County, CA
    Posts
    1
    Location

    Locking the name of a range

    I wrote a function that takes a dynamic range as its input and returns an array of outputs. I created the dynamic range using Insert->Name->Define.

    My function references the dynamic range so if the user changes what this name refers to then the function wont work.
    I don't want to lock the actual cells because that's where the user inputs values for the function. I would like to lock the name of the range ("InputRange") so that the use can't accidentally make that name refer to something else.

    I know that when you name a range there are invalid names such as "B1" since that refers to a range (cell B1) used by excel and cant refer to other things. I was hoping that I could add names to the invalid name list (like "InputRange") so that things wont get accidentally changed

    Is this possible?
    If not, is there a better way to pass the input range to my function that makes it less susceptible to change?

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Hide it

    [vba]

    Activeworkbook.Names("myName").Hidden = True[/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

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