We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

sheet.UsedRange.End.Row

I have noticed that on several occasions:

Dim rowend = sheet.UsedRange.End.Row

sheet.UsedRange.End.Row does not return the correct end row. I have an example of a sheet that has 124 as the end row. But it is being reported as 132 as the end row. Can you tell why this is happening?


2 Replies

AD Administrator Syncfusion Team December 27, 2007 05:55 AM UTC

Hi Mia,

We regret for the delayed response.

1.sheet.UsedRange.End.Row does not return the correct end row.

UsedRange property is used to get the range of used cells on a worksheet. so it determines the actual used range.

2.I have an example of a sheet that has 124 as the end row. But it is being reported as 132 as the end row. Can you tell why this is happening?

Normally,sheet.UsedRange is used to get the used range of the work sheet. If you want to get the total length of the sheet, you should use IWorksheet.Rows.Length to get the total length.



//To get the total length
int length=sheet.Rows.Length.ToString();



Please try the above code and if still the issue exists, could you please send your file in which the issue occurs so that we could sort out the cause of the issue with that file and provide you a solution?

Regards,
Yavana.G





ML Mia Lee May 1, 2009 06:56 PM UTC

Sorry, I didn't state my question correctly.

Example. I have data on line 124.

When I use
sheet.UsedRange.End.Row or length=sheet.Rows.Length or
worksheet.Range.LastRow

the number of rows that come back is 132 ( so there are extra blank rows). I only want the number or rows to be 124 and no extra blank rows.

Thanks,
Mia


Loader.
Live Chat Icon For mobile
Up arrow icon