PDA

View Full Version : Locking the name of a range



Peggaret
09-14-2011, 11:47 AM
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?

Bob Phillips
09-14-2011, 02:55 PM
Hide it



Activeworkbook.Names("myName").Hidden = True