PC Review


Reply
Thread Tools Rate Thread

What is default property of name object

 
 
=?Utf-8?B?Y2xhcmE=?=
Guest
Posts: n/a
 
      26th Jun 2007
Hi all,
I can use
Range("A1:a3").Name = "data"
to define a name object.

but Range("A1:a3").Name will display the address of the name object

Could you explain why?

Clara


--
thank you so much for your help
 
Reply With Quote
 
 
 
 
Peter T
Guest
Posts: n/a
 
      26th Jun 2007
Hi Clara,

The default property of a Name is RefersTo, hence if the name refers to a
range returning the default property will return its address

Maybe you want this -

On error resume next
s = ""
s = Range("A1:a3").Name.Name
on error goto 0
If len(s) then
msgbox s & vbcr & Range("A1:a3").Name
else
msgbox "the range is not defined"
End if

Regards,
Peter T

"clara" <(E-Mail Removed)> wrote in message
news:68DAC615-D4AF-4FEB-8CEF-(E-Mail Removed)...
> Hi all,
> I can use
> Range("A1:a3").Name = "data"
> to define a name object.
>
> but Range("A1:a3").Name will display the address of the name object
>
> Could you explain why?
>
> Clara
>
>
> --
> thank you so much for your help



 
Reply With Quote
 
=?Utf-8?B?Y2xhcmE=?=
Guest
Posts: n/a
 
      27th Jun 2007
Hi Peter,
Thank you very mcuh!
What I really mean is that there is an inconsistency here since we use
Range("A1:a3").Name = "data"( Set method) to assign a name, we can not
retrieve(Get) by referring to Range("A1:a3").Name

Clara
--
thank you so much for your help


"Peter T" wrote:

> Hi Clara,
>
> The default property of a Name is RefersTo, hence if the name refers to a
> range returning the default property will return its address
>
> Maybe you want this -
>
> On error resume next
> s = ""
> s = Range("A1:a3").Name.Name
> on error goto 0
> If len(s) then
> msgbox s & vbcr & Range("A1:a3").Name
> else
> msgbox "the range is not defined"
> End if
>
> Regards,
> Peter T
>
> "clara" <(E-Mail Removed)> wrote in message
> news:68DAC615-D4AF-4FEB-8CEF-(E-Mail Removed)...
> > Hi all,
> > I can use
> > Range("A1:a3").Name = "data"
> > to define a name object.
> >
> > but Range("A1:a3").Name will display the address of the name object
> >
> > Could you explain why?
> >
> > Clara
> >
> >
> > --
> > thank you so much for your help

>
>
>

 
Reply With Quote
 
Peter T
Guest
Posts: n/a
 
      27th Jun 2007
Hi again,

I see what you mean but it's not really an inconsistency

say you did -
Set rng = [a1]
then
v = rng
v returns the default property of the range which is its value, not the cell
reference or its name if it has one.

If you are trying to return your range's name then you need to return the
Name property of the Name object.
As before -
On error resume next ' in case the range doesn't have a Name
s = ""
s = Range("A1:a3").Name.Name

similarly
set nm = activeworkbook.names("test")
s = nm.Name ' 'test

Regards,
Peter T


"clara" <(E-Mail Removed)> wrote in message
news:BE0AA8B9-27C0-424D-A77C-(E-Mail Removed)...
> Hi Peter,
> Thank you very mcuh!
> What I really mean is that there is an inconsistency here since we use
> Range("A1:a3").Name = "data"( Set method) to assign a name, we can not
> retrieve(Get) by referring to Range("A1:a3").Name
>
> Clara
> --
> thank you so much for your help
>
>
> "Peter T" wrote:
>
> > Hi Clara,
> >
> > The default property of a Name is RefersTo, hence if the name refers to

a
> > range returning the default property will return its address
> >
> > Maybe you want this -
> >
> > On error resume next
> > s = ""
> > s = Range("A1:a3").Name.Name
> > on error goto 0
> > If len(s) then
> > msgbox s & vbcr & Range("A1:a3").Name
> > else
> > msgbox "the range is not defined"
> > End if
> >
> > Regards,
> > Peter T
> >
> > "clara" <(E-Mail Removed)> wrote in message
> > news:68DAC615-D4AF-4FEB-8CEF-(E-Mail Removed)...
> > > Hi all,
> > > I can use
> > > Range("A1:a3").Name = "data"
> > > to define a name object.
> > >
> > > but Range("A1:a3").Name will display the address of the name object
> > >
> > > Could you explain why?
> > >
> > > Clara
> > >
> > >
> > > --
> > > thank you so much for your help

> >
> >
> >



 
Reply With Quote
 
NickHK
Guest
Posts: n/a
 
      28th Jun 2007
Peter, Clara,

From Help:
Name property as it applies to the Font and Range objects.
Returns or sets the name of the object. The name of a Range object is a Name
object. For every other type of object, the name is a string. Read/write
Variant.
<This does not really help, as what does "the name of the object" mean in
this case ?>

So, if a Name has been set for the range:
?typename(Range("A1").name)
Name

Which makes sense.
But then
Range("A1").name="Name1"
?Range("A1").Name.name
Name1
?names("name1").RefersTo
=Sheet3!$A$1

should not work, as the default property for a Name is RefersTo, but this is
clearly setting the Name.Name correctly.
It does seems some short-cut in the implementation, which, whilst useful,
can be confusing.

NickHK

"Peter T" <peter_t@discussions> wrote in message
news:uPPz%(E-Mail Removed)...
> Hi again,
>
> I see what you mean but it's not really an inconsistency
>
> say you did -
> Set rng = [a1]
> then
> v = rng
> v returns the default property of the range which is its value, not the

cell
> reference or its name if it has one.
>
> If you are trying to return your range's name then you need to return the
> Name property of the Name object.
> As before -
> On error resume next ' in case the range doesn't have a Name
> s = ""
> s = Range("A1:a3").Name.Name
>
> similarly
> set nm = activeworkbook.names("test")
> s = nm.Name ' 'test
>
> Regards,
> Peter T
>
>
> "clara" <(E-Mail Removed)> wrote in message
> news:BE0AA8B9-27C0-424D-A77C-(E-Mail Removed)...
> > Hi Peter,
> > Thank you very mcuh!
> > What I really mean is that there is an inconsistency here since we use
> > Range("A1:a3").Name = "data"( Set method) to assign a name, we can not
> > retrieve(Get) by referring to Range("A1:a3").Name
> >
> > Clara
> > --
> > thank you so much for your help
> >
> >
> > "Peter T" wrote:
> >
> > > Hi Clara,
> > >
> > > The default property of a Name is RefersTo, hence if the name refers

to
> a
> > > range returning the default property will return its address
> > >
> > > Maybe you want this -
> > >
> > > On error resume next
> > > s = ""
> > > s = Range("A1:a3").Name.Name
> > > on error goto 0
> > > If len(s) then
> > > msgbox s & vbcr & Range("A1:a3").Name
> > > else
> > > msgbox "the range is not defined"
> > > End if
> > >
> > > Regards,
> > > Peter T
> > >
> > > "clara" <(E-Mail Removed)> wrote in message
> > > news:68DAC615-D4AF-4FEB-8CEF-(E-Mail Removed)...
> > > > Hi all,
> > > > I can use
> > > > Range("A1:a3").Name = "data"
> > > > to define a name object.
> > > >
> > > > but Range("A1:a3").Name will display the address of the name

object
> > > >
> > > > Could you explain why?
> > > >
> > > > Clara
> > > >
> > > >
> > > > --
> > > > thank you so much for your help
> > >
> > >
> > >

>
>



 
Reply With Quote
 
Peter T
Guest
Posts: n/a
 
      28th Jun 2007
Hi Nick,

Re this bit -

> But then
> Range("A1").name="Name1"
> ?Range("A1").Name.name
> Name1
> ?names("name1").RefersTo
> =Sheet3!$A$1
>
> should not work, as the default property for a Name is RefersTo,


Don't see any confusion here or why it "should not work"

A Range object has a Name property which is a Name object, assuming the
range is named.

As you say, the default property of the Name object is RefersTo which as
expected returns the string range reference (in the case of a range name).
This subject to the max 255 limit (or a bit less) even though the actual
defined range reference can be considerably more.

But a Name object also has a string Name property, similar to some other
objects, hence objDefinedName.Name returns the name of the Name.

Regards,
Peter T


"NickHK" <(E-Mail Removed)> wrote in message
news:#(E-Mail Removed)...
> Peter, Clara,
>
> From Help:
> Name property as it applies to the Font and Range objects.
> Returns or sets the name of the object. The name of a Range object is a

Name
> object. For every other type of object, the name is a string. Read/write
> Variant.
> <This does not really help, as what does "the name of the object" mean in
> this case ?>
>
> So, if a Name has been set for the range:
> ?typename(Range("A1").name)
> Name
>
> Which makes sense.
> But then
> Range("A1").name="Name1"
> ?Range("A1").Name.name
> Name1
> ?names("name1").RefersTo
> =Sheet3!$A$1
>
> should not work, as the default property for a Name is RefersTo, but this

is
> clearly setting the Name.Name correctly.
> It does seems some short-cut in the implementation, which, whilst useful,
> can be confusing.
>
> NickHK
>
> "Peter T" <peter_t@discussions> wrote in message
> news:uPPz%(E-Mail Removed)...
> > Hi again,
> >
> > I see what you mean but it's not really an inconsistency
> >
> > say you did -
> > Set rng = [a1]
> > then
> > v = rng
> > v returns the default property of the range which is its value, not the

> cell
> > reference or its name if it has one.
> >
> > If you are trying to return your range's name then you need to return

the
> > Name property of the Name object.
> > As before -
> > On error resume next ' in case the range doesn't have a Name
> > s = ""
> > s = Range("A1:a3").Name.Name
> >
> > similarly
> > set nm = activeworkbook.names("test")
> > s = nm.Name ' 'test
> >
> > Regards,
> > Peter T
> >
> >
> > "clara" <(E-Mail Removed)> wrote in message
> > news:BE0AA8B9-27C0-424D-A77C-(E-Mail Removed)...
> > > Hi Peter,
> > > Thank you very mcuh!
> > > What I really mean is that there is an inconsistency here since we use
> > > Range("A1:a3").Name = "data"( Set method) to assign a name, we can not
> > > retrieve(Get) by referring to Range("A1:a3").Name
> > >
> > > Clara
> > > --
> > > thank you so much for your help
> > >
> > >
> > > "Peter T" wrote:
> > >
> > > > Hi Clara,
> > > >
> > > > The default property of a Name is RefersTo, hence if the name refers

> to
> > a
> > > > range returning the default property will return its address
> > > >
> > > > Maybe you want this -
> > > >
> > > > On error resume next
> > > > s = ""
> > > > s = Range("A1:a3").Name.Name
> > > > on error goto 0
> > > > If len(s) then
> > > > msgbox s & vbcr & Range("A1:a3").Name
> > > > else
> > > > msgbox "the range is not defined"
> > > > End if
> > > >
> > > > Regards,
> > > > Peter T
> > > >
> > > > "clara" <(E-Mail Removed)> wrote in message
> > > > news:68DAC615-D4AF-4FEB-8CEF-(E-Mail Removed)...
> > > > > Hi all,
> > > > > I can use
> > > > > Range("A1:a3").Name = "data"
> > > > > to define a name object.
> > > > >
> > > > > but Range("A1:a3").Name will display the address of the name

> object
> > > > >
> > > > > Could you explain why?
> > > > >
> > > > > Clara
> > > > >
> > > > >
> > > > > --
> > > > > thank you so much for your help
> > > >
> > > >
> > > >

> >
> >

>
>




 
Reply With Quote
 
NickHK
Guest
Posts: n/a
 
      28th Jun 2007
Peter,
Only that if you can do this to a non-default property of the Name object,
ie. Name.Name
Range("A1").Name="Name1"
what are you actually setting ?

Small point, but I understand Clara's confusion.

NickHK

"Peter T" <peter_t@discussions> wrote in message
news:%23$(E-Mail Removed)...
> Hi Nick,
>
> Re this bit -
>
> > But then
> > Range("A1").name="Name1"
> > ?Range("A1").Name.name
> > Name1
> > ?names("name1").RefersTo
> > =Sheet3!$A$1
> >
> > should not work, as the default property for a Name is RefersTo,

>
> Don't see any confusion here or why it "should not work"
>
> A Range object has a Name property which is a Name object, assuming the
> range is named.
>
> As you say, the default property of the Name object is RefersTo which as
> expected returns the string range reference (in the case of a range name).
> This subject to the max 255 limit (or a bit less) even though the actual
> defined range reference can be considerably more.
>
> But a Name object also has a string Name property, similar to some other
> objects, hence objDefinedName.Name returns the name of the Name.
>
> Regards,
> Peter T
>
>
> "NickHK" <(E-Mail Removed)> wrote in message
> news:#(E-Mail Removed)...
> > Peter, Clara,
> >
> > From Help:
> > Name property as it applies to the Font and Range objects.
> > Returns or sets the name of the object. The name of a Range object is a

> Name
> > object. For every other type of object, the name is a string. Read/write
> > Variant.
> > <This does not really help, as what does "the name of the object" mean

in
> > this case ?>
> >
> > So, if a Name has been set for the range:
> > ?typename(Range("A1").name)
> > Name
> >
> > Which makes sense.
> > But then
> > Range("A1").name="Name1"
> > ?Range("A1").Name.name
> > Name1
> > ?names("name1").RefersTo
> > =Sheet3!$A$1
> >
> > should not work, as the default property for a Name is RefersTo, but

this
> is
> > clearly setting the Name.Name correctly.
> > It does seems some short-cut in the implementation, which, whilst

useful,
> > can be confusing.
> >
> > NickHK
> >
> > "Peter T" <peter_t@discussions> wrote in message
> > news:uPPz%(E-Mail Removed)...
> > > Hi again,
> > >
> > > I see what you mean but it's not really an inconsistency
> > >
> > > say you did -
> > > Set rng = [a1]
> > > then
> > > v = rng
> > > v returns the default property of the range which is its value, not

the
> > cell
> > > reference or its name if it has one.
> > >
> > > If you are trying to return your range's name then you need to return

> the
> > > Name property of the Name object.
> > > As before -
> > > On error resume next ' in case the range doesn't have a Name
> > > s = ""
> > > s = Range("A1:a3").Name.Name
> > >
> > > similarly
> > > set nm = activeworkbook.names("test")
> > > s = nm.Name ' 'test
> > >
> > > Regards,
> > > Peter T
> > >
> > >
> > > "clara" <(E-Mail Removed)> wrote in message
> > > news:BE0AA8B9-27C0-424D-A77C-(E-Mail Removed)...
> > > > Hi Peter,
> > > > Thank you very mcuh!
> > > > What I really mean is that there is an inconsistency here since we

use
> > > > Range("A1:a3").Name = "data"( Set method) to assign a name, we can

not
> > > > retrieve(Get) by referring to Range("A1:a3").Name
> > > >
> > > > Clara
> > > > --
> > > > thank you so much for your help
> > > >
> > > >
> > > > "Peter T" wrote:
> > > >
> > > > > Hi Clara,
> > > > >
> > > > > The default property of a Name is RefersTo, hence if the name

refers
> > to
> > > a
> > > > > range returning the default property will return its address
> > > > >
> > > > > Maybe you want this -
> > > > >
> > > > > On error resume next
> > > > > s = ""
> > > > > s = Range("A1:a3").Name.Name
> > > > > on error goto 0
> > > > > If len(s) then
> > > > > msgbox s & vbcr & Range("A1:a3").Name
> > > > > else
> > > > > msgbox "the range is not defined"
> > > > > End if
> > > > >
> > > > > Regards,
> > > > > Peter T
> > > > >
> > > > > "clara" <(E-Mail Removed)> wrote in message
> > > > > news:68DAC615-D4AF-4FEB-8CEF-(E-Mail Removed)...
> > > > > > Hi all,
> > > > > > I can use
> > > > > > Range("A1:a3").Name = "data"
> > > > > > to define a name object.
> > > > > >
> > > > > > but Range("A1:a3").Name will display the address of the name

> > object
> > > > > >
> > > > > > Could you explain why?
> > > > > >
> > > > > > Clara
> > > > > >
> > > > > >
> > > > > > --
> > > > > > thank you so much for your help
> > > > >
> > > > >
> > > > >
> > >
> > >

> >
> >

>
>
>




 
Reply With Quote
 
Peter T
Guest
Posts: n/a
 
      28th Jun 2007
I follow the confusion and to a certain extent the oddity

> Range("A1").Name="Name1"
> what are you actually setting ?


Not Set'ing but assigning a string name to the range's name-object property
(the property always exists even if the name doesn't). This in turn adds the
Name to the Names collection.

Regards,
Peter T

"NickHK" <(E-Mail Removed)> wrote in message
news:#(E-Mail Removed)...
> Peter,
> Only that if you can do this to a non-default property of the Name object,
> ie. Name.Name
> Range("A1").Name="Name1"
> what are you actually setting ?
>
> Small point, but I understand Clara's confusion.
>
> NickHK
>
> "Peter T" <peter_t@discussions> wrote in message
> news:%23$(E-Mail Removed)...
> > Hi Nick,
> >
> > Re this bit -
> >
> > > But then
> > > Range("A1").name="Name1"
> > > ?Range("A1").Name.name
> > > Name1
> > > ?names("name1").RefersTo
> > > =Sheet3!$A$1
> > >
> > > should not work, as the default property for a Name is RefersTo,

> >
> > Don't see any confusion here or why it "should not work"
> >
> > A Range object has a Name property which is a Name object, assuming the
> > range is named.
> >
> > As you say, the default property of the Name object is RefersTo which as
> > expected returns the string range reference (in the case of a range

name).
> > This subject to the max 255 limit (or a bit less) even though the actual
> > defined range reference can be considerably more.
> >
> > But a Name object also has a string Name property, similar to some other
> > objects, hence objDefinedName.Name returns the name of the Name.
> >
> > Regards,
> > Peter T
> >
> >
> > "NickHK" <(E-Mail Removed)> wrote in message
> > news:#(E-Mail Removed)...
> > > Peter, Clara,
> > >
> > > From Help:
> > > Name property as it applies to the Font and Range objects.
> > > Returns or sets the name of the object. The name of a Range object is

a
> > Name
> > > object. For every other type of object, the name is a string.

Read/write
> > > Variant.
> > > <This does not really help, as what does "the name of the object" mean

> in
> > > this case ?>
> > >
> > > So, if a Name has been set for the range:
> > > ?typename(Range("A1").name)
> > > Name
> > >
> > > Which makes sense.
> > > But then
> > > Range("A1").name="Name1"
> > > ?Range("A1").Name.name
> > > Name1
> > > ?names("name1").RefersTo
> > > =Sheet3!$A$1
> > >
> > > should not work, as the default property for a Name is RefersTo, but

> this
> > is
> > > clearly setting the Name.Name correctly.
> > > It does seems some short-cut in the implementation, which, whilst

> useful,
> > > can be confusing.
> > >
> > > NickHK
> > >
> > > "Peter T" <peter_t@discussions> wrote in message
> > > news:uPPz%(E-Mail Removed)...
> > > > Hi again,
> > > >
> > > > I see what you mean but it's not really an inconsistency
> > > >
> > > > say you did -
> > > > Set rng = [a1]
> > > > then
> > > > v = rng
> > > > v returns the default property of the range which is its value, not

> the
> > > cell
> > > > reference or its name if it has one.
> > > >
> > > > If you are trying to return your range's name then you need to

return
> > the
> > > > Name property of the Name object.
> > > > As before -
> > > > On error resume next ' in case the range doesn't have a Name
> > > > s = ""
> > > > s = Range("A1:a3").Name.Name
> > > >
> > > > similarly
> > > > set nm = activeworkbook.names("test")
> > > > s = nm.Name ' 'test
> > > >
> > > > Regards,
> > > > Peter T
> > > >
> > > >
> > > > "clara" <(E-Mail Removed)> wrote in message
> > > > news:BE0AA8B9-27C0-424D-A77C-(E-Mail Removed)...
> > > > > Hi Peter,
> > > > > Thank you very mcuh!
> > > > > What I really mean is that there is an inconsistency here since we

> use
> > > > > Range("A1:a3").Name = "data"( Set method) to assign a name, we can

> not
> > > > > retrieve(Get) by referring to Range("A1:a3").Name
> > > > >
> > > > > Clara
> > > > > --
> > > > > thank you so much for your help
> > > > >
> > > > >
> > > > > "Peter T" wrote:
> > > > >
> > > > > > Hi Clara,
> > > > > >
> > > > > > The default property of a Name is RefersTo, hence if the name

> refers
> > > to
> > > > a
> > > > > > range returning the default property will return its address
> > > > > >
> > > > > > Maybe you want this -
> > > > > >
> > > > > > On error resume next
> > > > > > s = ""
> > > > > > s = Range("A1:a3").Name.Name
> > > > > > on error goto 0
> > > > > > If len(s) then
> > > > > > msgbox s & vbcr & Range("A1:a3").Name
> > > > > > else
> > > > > > msgbox "the range is not defined"
> > > > > > End if
> > > > > >
> > > > > > Regards,
> > > > > > Peter T
> > > > > >
> > > > > > "clara" <(E-Mail Removed)> wrote in message
> > > > > > news:68DAC615-D4AF-4FEB-8CEF-(E-Mail Removed)...
> > > > > > > Hi all,
> > > > > > > I can use
> > > > > > > Range("A1:a3").Name = "data"
> > > > > > > to define a name object.
> > > > > > >
> > > > > > > but Range("A1:a3").Name will display the address of the name
> > > object
> > > > > > >
> > > > > > > Could you explain why?
> > > > > > >
> > > > > > > Clara
> > > > > > >
> > > > > > >
> > > > > > > --
> > > > > > > thank you so much for your help
> > > > > >
> > > > > >
> > > > > >
> > > >
> > > >
> > >
> > >

> >
> >
> >

>
>
>



 
Reply With Quote
 
NickHK
Guest
Posts: n/a
 
      28th Jun 2007
Peter,
Succintly put.
I'm glad (most of) the rest of the Object Model is more straight-forward.

NickHK

"Peter T" <peter_t@discussions> ¼¶¼g©ó¶l¥ó·s»D:(E-Mail Removed)...
>I follow the confusion and to a certain extent the oddity
>
>> Range("A1").Name="Name1"
>> what are you actually setting ?

>
> Not Set'ing but assigning a string name to the range's name-object
> property
> (the property always exists even if the name doesn't). This in turn adds
> the
> Name to the Names collection.
>
> Regards,
> Peter T
>
> "NickHK" <(E-Mail Removed)> wrote in message
> news:#(E-Mail Removed)...
>> Peter,
>> Only that if you can do this to a non-default property of the Name
>> object,
>> ie. Name.Name
>> Range("A1").Name="Name1"
>> what are you actually setting ?
>>
>> Small point, but I understand Clara's confusion.
>>
>> NickHK
>>
>> "Peter T" <peter_t@discussions> wrote in message
>> news:%23$(E-Mail Removed)...
>> > Hi Nick,
>> >
>> > Re this bit -
>> >
>> > > But then
>> > > Range("A1").name="Name1"
>> > > ?Range("A1").Name.name
>> > > Name1
>> > > ?names("name1").RefersTo
>> > > =Sheet3!$A$1
>> > >
>> > > should not work, as the default property for a Name is RefersTo,
>> >
>> > Don't see any confusion here or why it "should not work"
>> >
>> > A Range object has a Name property which is a Name object, assuming the
>> > range is named.
>> >
>> > As you say, the default property of the Name object is RefersTo which
>> > as
>> > expected returns the string range reference (in the case of a range

> name).
>> > This subject to the max 255 limit (or a bit less) even though the
>> > actual
>> > defined range reference can be considerably more.
>> >
>> > But a Name object also has a string Name property, similar to some
>> > other
>> > objects, hence objDefinedName.Name returns the name of the Name.
>> >
>> > Regards,
>> > Peter T
>> >
>> >
>> > "NickHK" <(E-Mail Removed)> wrote in message
>> > news:#(E-Mail Removed)...
>> > > Peter, Clara,
>> > >
>> > > From Help:
>> > > Name property as it applies to the Font and Range objects.
>> > > Returns or sets the name of the object. The name of a Range object is

> a
>> > Name
>> > > object. For every other type of object, the name is a string.

> Read/write
>> > > Variant.
>> > > <This does not really help, as what does "the name of the object"
>> > > mean

>> in
>> > > this case ?>
>> > >
>> > > So, if a Name has been set for the range:
>> > > ?typename(Range("A1").name)
>> > > Name
>> > >
>> > > Which makes sense.
>> > > But then
>> > > Range("A1").name="Name1"
>> > > ?Range("A1").Name.name
>> > > Name1
>> > > ?names("name1").RefersTo
>> > > =Sheet3!$A$1
>> > >
>> > > should not work, as the default property for a Name is RefersTo, but

>> this
>> > is
>> > > clearly setting the Name.Name correctly.
>> > > It does seems some short-cut in the implementation, which, whilst

>> useful,
>> > > can be confusing.
>> > >
>> > > NickHK
>> > >
>> > > "Peter T" <peter_t@discussions> wrote in message
>> > > news:uPPz%(E-Mail Removed)...
>> > > > Hi again,
>> > > >
>> > > > I see what you mean but it's not really an inconsistency
>> > > >
>> > > > say you did -
>> > > > Set rng = [a1]
>> > > > then
>> > > > v = rng
>> > > > v returns the default property of the range which is its value, not

>> the
>> > > cell
>> > > > reference or its name if it has one.
>> > > >
>> > > > If you are trying to return your range's name then you need to

> return
>> > the
>> > > > Name property of the Name object.
>> > > > As before -
>> > > > On error resume next ' in case the range doesn't have a Name
>> > > > s = ""
>> > > > s = Range("A1:a3").Name.Name
>> > > >
>> > > > similarly
>> > > > set nm = activeworkbook.names("test")
>> > > > s = nm.Name ' 'test
>> > > >
>> > > > Regards,
>> > > > Peter T
>> > > >
>> > > >
>> > > > "clara" <(E-Mail Removed)> wrote in message
>> > > > news:BE0AA8B9-27C0-424D-A77C-(E-Mail Removed)...
>> > > > > Hi Peter,
>> > > > > Thank you very mcuh!
>> > > > > What I really mean is that there is an inconsistency here since
>> > > > > we

>> use
>> > > > > Range("A1:a3").Name = "data"( Set method) to assign a name, we
>> > > > > can

>> not
>> > > > > retrieve(Get) by referring to Range("A1:a3").Name
>> > > > >
>> > > > > Clara
>> > > > > --
>> > > > > thank you so much for your help
>> > > > >
>> > > > >
>> > > > > "Peter T" wrote:
>> > > > >
>> > > > > > Hi Clara,
>> > > > > >
>> > > > > > The default property of a Name is RefersTo, hence if the name

>> refers
>> > > to
>> > > > a
>> > > > > > range returning the default property will return its address
>> > > > > >
>> > > > > > Maybe you want this -
>> > > > > >
>> > > > > > On error resume next
>> > > > > > s = ""
>> > > > > > s = Range("A1:a3").Name.Name
>> > > > > > on error goto 0
>> > > > > > If len(s) then
>> > > > > > msgbox s & vbcr & Range("A1:a3").Name
>> > > > > > else
>> > > > > > msgbox "the range is not defined"
>> > > > > > End if
>> > > > > >
>> > > > > > Regards,
>> > > > > > Peter T
>> > > > > >
>> > > > > > "clara" <(E-Mail Removed)> wrote in message
>> > > > > > news:68DAC615-D4AF-4FEB-8CEF-(E-Mail Removed)...
>> > > > > > > Hi all,
>> > > > > > > I can use
>> > > > > > > Range("A1:a3").Name = "data"
>> > > > > > > to define a name object.
>> > > > > > >
>> > > > > > > but Range("A1:a3").Name will display the address of the
>> > > > > > > name
>> > > object
>> > > > > > >
>> > > > > > > Could you explain why?
>> > > > > > >
>> > > > > > > Clara
>> > > > > > >
>> > > > > > >
>> > > > > > > --
>> > > > > > > thank you so much for your help
>> > > > > >
>> > > > > >
>> > > > > >
>> > > >
>> > > >
>> > >
>> > >
>> >
>> >
>> >

>>
>>
>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to find default property for particular object. Alojz Microsoft Excel Programming 9 22nd Apr 2010 02:55 AM
Getting a object property inside another object property -- pleassehelp!! almurph@altavista.com Microsoft C# .NET 1 12th Feb 2009 02:25 PM
Binding to property of property of object collection TS Microsoft ASP .NET 3 31st Aug 2006 01:57 PM
Where is the "default" property of the Command Button Object in VB.net simonoficina@gmail.com Microsoft VB .NET 15 25th Aug 2006 01:38 PM
Default Property from a .NET object kevin_g_frey@hotmail.com Microsoft VC .NET 1 21st Mar 2005 12:02 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:50 PM.