ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Rows.Count (https://www.excelbanter.com/excel-programming/319717-rows-count.html)

Wally Steadman[_4_]

Rows.Count
 
OK this is a really goofy question I am sure, but I see many post on the
newsgroups and they say stuff like
Rows.Count and I was wondering where I could find the information that shows
me it is Rows.Count, when I look in the Help Files under RowCount method I
don't see where it says to type Rows.count. I have used it and know it
works so I am not questioning it, I guess I am trying to find out how to
know when to use the . or something.



Norman Jones

Rows.Count
 
Hi Wally,

The Rows property can be qualified with a worksheet, range or application
object and returns a range object that refers to all the rows in the object
qualifier.

Using Rows without a qualifier is equivalent to using Application.Rows and
will return a range object which refers to all the rows in an Excel
worksheet.

So, if the intention is to return the worksheet row count it is not
necessary explicitly.to qualify the Rows property. If, however, the row
count of a range is sought, then it is essential to qualify: eg:

iRows = Range("MyNamedRange").Rows.Count

or:

With Range("MyNamedRange")
iRows = .Rows.Count
End With

It would be possible to replace the unqualified Rows.Count with (its
current equivalent value of) 65536. Rows.Count , however allows for
(possible) future specification changes and does not require the number to
be memorised.

---
Regards,
Norman



"Wally Steadman" wrote in message
...
OK this is a really goofy question I am sure, but I see many post on the
newsgroups and they say stuff like
Rows.Count and I was wondering where I could find the information that
shows
me it is Rows.Count, when I look in the Help Files under RowCount method I
don't see where it says to type Rows.count. I have used it and know it
works so I am not questioning it, I guess I am trying to find out how to
know when to use the . or something.





Bob Phillips[_6_]

Rows.Count
 
Wally,

In many ways this is a catch-22 situation, in that you need to about what
you are looking up to look it up ;-).

But, happily, there are some strategies you can use. Essentially, you need
to familiarise with the Excel object model. Start by looking up 'Microsoft
Excel Object' in help, you will see the first level there are you click on
any object to look at the next level down, and so on.

Another good way is to open the object browser in the VBE. Select Excel from
the dropdown, and here you can see various objects and constant groups on
the left, with associated properties and methods on the right. So for
instance, if you select Range, you can see Rows on the right, which shows
that Range has a Rows property.

In intellisense, if you type an item, you will get a dropdown list of
properties and methods associated with it, so again, type Rows. (note the
dot) in the immediate window, and you will see the methods and properties
for Rows (which includes Count here).

Then you need experience and apply that experience (the catch-22 as I
mentioned). Most collections will have a Count property,. so knowing that
you are dealing with a collection gives you a hint. But you need to do your
homework, get to know the object model, investigate the properties and
methods, read the posts to see what is being discussed, practice, practice,
and then practice.


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Wally Steadman" wrote in message
...
OK this is a really goofy question I am sure, but I see many post on the
newsgroups and they say stuff like
Rows.Count and I was wondering where I could find the information that

shows
me it is Rows.Count, when I look in the Help Files under RowCount method I
don't see where it says to type Rows.count. I have used it and know it
works so I am not questioning it, I guess I am trying to find out how to
know when to use the . or something.





Wally Steadman[_4_]

Rows.Count
 
Thank you very much. Your suggestion is what I am doing and I appreciate
it. I can do some basic VBA stuff but definitely trying to get better at
it. I have a few books on it so again thank you for your assistance to all
who answered this post.

Wally

"Bob Phillips" wrote in message
...
Wally,

In many ways this is a catch-22 situation, in that you need to about what
you are looking up to look it up ;-).

But, happily, there are some strategies you can use. Essentially, you need
to familiarise with the Excel object model. Start by looking up 'Microsoft
Excel Object' in help, you will see the first level there are you click on
any object to look at the next level down, and so on.

Another good way is to open the object browser in the VBE. Select Excel

from
the dropdown, and here you can see various objects and constant groups on
the left, with associated properties and methods on the right. So for
instance, if you select Range, you can see Rows on the right, which shows
that Range has a Rows property.

In intellisense, if you type an item, you will get a dropdown list of
properties and methods associated with it, so again, type Rows. (note the
dot) in the immediate window, and you will see the methods and properties
for Rows (which includes Count here).

Then you need experience and apply that experience (the catch-22 as I
mentioned). Most collections will have a Count property,. so knowing that
you are dealing with a collection gives you a hint. But you need to do

your
homework, get to know the object model, investigate the properties and
methods, read the posts to see what is being discussed, practice,

practice,
and then practice.


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Wally Steadman" wrote in message
...
OK this is a really goofy question I am sure, but I see many post on the
newsgroups and they say stuff like
Rows.Count and I was wondering where I could find the information that

shows
me it is Rows.Count, when I look in the Help Files under RowCount method

I
don't see where it says to type Rows.count. I have used it and know it
works so I am not questioning it, I guess I am trying to find out how to
know when to use the . or something.








All times are GMT +1. The time now is 05:35 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com