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.
Unfortunately, activation email could not send to your email. Please try again.

Is there a way to find the last used cell?

Thread ID:

Created:

Updated:

Platform:

Replies:

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

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 01:10 AM

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.

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.

;