Re: Re: How to get the rows count in EXCEL work sheet ??
 From: Gary''s Student <GarysStudent@xxxxxxxxxxxxxxxxxxxxxxxxx>
 Date: Sat, 18 Nov 2006 14:42:01 0800
You should use Karl's formula. Consider a worksheet completely empty except
for ones in A9 and A10.
MsgBox (Sheet1.Cells(Sheet1.Rows.Count, "G").End(xlUp).Row)
will return an incorrect value of 1
MsgBox (ActiveSheet.UsedRange.Rows.Count)
will return the correct value of 2

Gary's Student
"nickong" wrote:
Thank you , Karl.
i found another way to do this,

Sheet1.Cells(Sheet1.Rows.Count, "G").End(xlUp).Row

and i think your suggestion ActiveSheet.UsedRange.Rows.Count is better than
that.
thank you very much~ :)
 Original Message 
From: "Karl E. Peterson" <karl@xxxxxxxx>
Newsgroups: microsoft.public.office.developer.vba
Sent: Friday, November 17, 2006 10:18 AM
Subject: Re: How to get the rows count in EXCEL work sheet ??
nickong wrote:
Hi,all
How to get the rows count in excel worksheet ?

dim i As Integer
i= Sheet1.Rows.Count

i get the number returned: 65536
but my worksheet only contain 5000 rows , how could this happen ?
how can i get the actual count number ?
which funciton should i use ???
Try ActiveSheet.UsedRange.Rows.Count

Working without a .NET?
http://classicvb.org/
 References:
 Re: Re: How to get the rows count in EXCEL work sheet ??
 From: nickong
 Re: Re: How to get the rows count in EXCEL work sheet ??
 Prev by Date: [newbie] How do I store user info?
 Next by Date: RE: Beta 2007 Software
 Previous by thread: Re: Re: How to get the rows count in EXCEL work sheet ??
 Next by thread: [newbie] How do I store user info?
 Index(es):
Relevant Pages
