How to get the number of nonempty rows in excel application?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi, there,

I have an xls file, and need to get the number of nonempty rows from one
worksheet. How to know what is the last line of this worksheet?

I am using Microsoft Excel 9.0 library, Excel 2000, and C#.

Thanks,

Gary
 
Gary,

Check out the UsedRange property on the Worksheet. It will give you the
smallest grid on the worksheet which has all the content in it. However,
this might mean there are empty spaces in the content, but from there, you
can search it to filter out or find your items.

Hope this helps.
 
Back
Top