Range name applies to list, or simply range; collection-index/member-ofprecedence

P

paul.domaskis

I must be doing something different from what you have in mind. When
I do Insert->Name->Define, I see the named ranges, including the names
that I'm not sure whether they are attached to fixed ranges, or list
ranges). When I click F5, I also see those names.

Furthermore, I did some tests in VBA., where "TheName" is the name
which I'm not sure refers to a List or a fixed Range.

Works:
nRows = _
Sheets("SheetName").ListObjects(1).ListRows.Count

Works:
nRows = _
Sheets("SheetName").Range("TheName").Rows.Count

Doesn't Work:
nRows = _
Sheets("SheetName").ListObjects("TheName").ListRows.Count

The fact that "TheName" isn't accepted as an index to collection
ListObjects implies (doesn't prove) that "TheName" is associated with
fixed Range rather than a list. However, when I add/remove rows to/
from the list in Excel, the range associated with "TheName" updates
accordingly. Would you have any insight that can help make sense of
this?

I also was wondering about operator precedence. It seems that the
member-of function (the dot/period) has the same precedence as the
collection indexing function (brackets following a collection name,
enclosing either a numerical or string index). These seem to be
evaluated from left to right. Is this correct?

Finally, where is it documented what arguments accepted within the
indexing brackets for a ListObjects collection? In C++/STL, there
would be constructors for this, but this is a different environment
that I am still trying to get the subtleties of.

Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top