Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Is this for real? | Excel Worksheet Functions | |||
Real Protection | Excel Discussion (Misc queries) | |||
A real puzzle? | Excel Discussion (Misc queries) | |||
A real quickie! | Excel Discussion (Misc queries) | |||
Real Value of .UsedRange.Rows.Count | Excel Worksheet Functions |