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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Is there a way to find the last used cell?

Thread ID:

Created:

Updated:

Platform:

Replies:

96088 Aug 19,2010 08:48 PM UTC Aug 20,2010 05:10 AM UTC ASP.NET Web Forms (Classic) 1
loading
Tags: XlsIO
Mark Oudesluys
Asked On August 19, 2010 08:48 PM UTC

Hi,

I am trying to find a simple way of finding the last column with data in it.

In Excel VBA, the command Worksheet(sheetname).SpecialCells(xlCellTypeLastCell) will get the last cell used in the worksheet. Is there an equivalent command in Syncfusion XlsIO?

Thanks,
Mark

Sathish Babu R [Syncfusion]
Replied On August 20, 2010 05:10 AM UTC

Hi Mark ,

Thank you for your interest in Syncfusion products.

In our XlsIO, It is possible to get the last cell in the used range with the below code snippet. Also we have attached sample for your reference. Could you please try the same and let us know if this helps you.

Code Snippet:

C#
IRange usedRange = sheet.UsedRange;
IRange lastCell = usedRange[usedRange.LastRow, usedRange.LastColumn];
lastCell.Text = "Last cell";

VB.Net
Dim usedRange as IRange = sheet.UsedRange
Dim lastCell as IRange
lastCell = usedRange(usedRange.LastRow, usedRange.LastColumn)
lastCell.Text = "Last cell"

Sample:
http://help.syncfusion.com/samples/xlsio.windows/supports/F96088-%20Find%20last%20cell.zip

Please let us know if you have any queries.

Regards,
Sathish

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;