#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Real Rows

hello.

How can I know the real number of rows that has an excel sheet? I must read
it from an VFP application, but when I using COUNT method, returns all
records including empty


Thanks and regards


Xabi


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Real Rows

activesheet.usedrange.rows.count

--
Regards,
Tom Ogilvy

"Xabi" wrote in message
...
hello.

How can I know the real number of rows that has an excel sheet? I must

read
it from an VFP application, but when I using COUNT method, returns all
records including empty


Thanks and regards


Xabi




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default Real Rows

Xabi,
Tom's line of code returns the last row number used on a worksheet. If blank
records (rows) are above the last record, the results may not be accurate.
You should sort the worksheet first to guarantee accuracy.

If the criteria of a populated record rests on a value in a praticular field
(column), this will work without sorting...

Application.CountA(ActiveSheet.Columns(1))

Dale Preuss

"Tom Ogilvy" wrote:

activesheet.usedrange.rows.count

--
Regards,
Tom Ogilvy

"Xabi" wrote in message
...
hello.

How can I know the real number of rows that has an excel sheet? I must

read
it from an VFP application, but when I using COUNT method, returns all
records including empty


Thanks and regards


Xabi





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Real Rows

Tom's line of code returns the last row number used on a worksheet.

No it doesn't. It gives the number of rows in the used range. the used
range doesn't have to start in A1.

Also, since the OP is calling Excel from VFP, I assume he is working with a
table, so there should be no blank rows.

It is also correct the UsedRange does not necessarily reflect just populated
rows. It can overstate how many rows are actually populated, but if the OP
has imported a database, it is unlikely this would be a problem. If the OP
has a column that can be used to determine filled cells, then they can do

Columns(3).SpecialCells(xlConstants).count



--
Regards,
Tom Ogilvy


"Dale Preuss" wrote in message
...
Xabi,
Tom's line of code returns the last row number used on a worksheet. If

blank
records (rows) are above the last record, the results may not be accurate.
You should sort the worksheet first to guarantee accuracy.

If the criteria of a populated record rests on a value in a praticular

field
(column), this will work without sorting...

Application.CountA(ActiveSheet.Columns(1))

Dale Preuss

"Tom Ogilvy" wrote:

activesheet.usedrange.rows.count

--
Regards,
Tom Ogilvy

"Xabi" wrote in message
...
hello.

How can I know the real number of rows that has an excel sheet? I

must
read
it from an VFP application, but when I using COUNT method, returns all
records including empty


Thanks and regards


Xabi







  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default Real Rows

Tom,
I stand corrected. I had never used that function without a header row, but
had data sheets with deleted records (empty rows). Since that discovery, I
have always sorted the data to remove blank rows.
Dale

"Tom Ogilvy" wrote:

Tom's line of code returns the last row number used on a worksheet.


No it doesn't. It gives the number of rows in the used range. the used
range doesn't have to start in A1.

Also, since the OP is calling Excel from VFP, I assume he is working with a
table, so there should be no blank rows.

It is also correct the UsedRange does not necessarily reflect just populated
rows. It can overstate how many rows are actually populated, but if the OP
has imported a database, it is unlikely this would be a problem. If the OP
has a column that can be used to determine filled cells, then they can do

Columns(3).SpecialCells(xlConstants).count



--
Regards,
Tom Ogilvy


"Dale Preuss" wrote in message
...
Xabi,
Tom's line of code returns the last row number used on a worksheet. If

blank
records (rows) are above the last record, the results may not be accurate.
You should sort the worksheet first to guarantee accuracy.

If the criteria of a populated record rests on a value in a praticular

field
(column), this will work without sorting...

Application.CountA(ActiveSheet.Columns(1))

Dale Preuss

"Tom Ogilvy" wrote:

activesheet.usedrange.rows.count

--
Regards,
Tom Ogilvy

"Xabi" wrote in message
...
hello.

How can I know the real number of rows that has an excel sheet? I

must
read
it from an VFP application, but when I using COUNT method, returns all
records including empty


Thanks and regards


Xabi








Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is this for real? Johnny[_4_] Excel Worksheet Functions 1 August 29th 09 10:56 PM
Real Protection Learning Excel Excel Discussion (Misc queries) 4 February 10th 08 09:38 PM
A real puzzle? paulsuk Excel Discussion (Misc queries) 7 March 7th 07 07:27 PM
A real quickie! JamesBurrows Excel Discussion (Misc queries) 5 June 7th 06 03:43 PM
Real Value of .UsedRange.Rows.Count dazman Excel Worksheet Functions 2 August 25th 05 03:24 PM


All times are GMT +1. The time now is 09:59 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"