View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jim Rech Jim Rech is offline
external usenet poster
 
Posts: 2,718
Default returning the first name on the list assigned to a particular rang

I'm not sure what you're trying to do but if it's to make a name hidden this
is the way:

Names("MyName").Visible = False

--
Jim
"Kimmo Kallio" wrote in message
...
| Hi,
|
| my problem is as follows:
|
| There is a piece of code in MS VB Help that says:
|
| "Range Objects
| Although a Range object can have more than one name, there's no Names
| collection for the Range object. Use Name with a Range object to return
the
| first name from the list of names (sorted alphabetically) assigned to the
| range. The following example sets the Visible property for the first name
| assigned to cells A1:B1 on worksheet one.
|
| Worksheets(1).Range("a1:b1").Name.Visible = False"
|
| Now, the problem is that it doesn't work, at least for me. I have defined
a
| name "Whole" with reference: "=Sheet1!$1:$65536", and a macro:
|
| Sub Wholemacro()
| Worksheets("sheet1").Range("a1").Name.Visible = False
| End Sub
|
| Nevertheless, all I ever get when trying to run the code is "Run-time
error
| '1004': Application-defined or object-defined error". The macro code is as
| follows:
|
| Please help!
|
| Thanks in advance
|
|