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.

Determine whether a Range exists

Thread ID:

Created:

Updated:

Platform:

Replies:

56666 Feb 19,2007 02:48 AM Jun 24,2008 04:45 AM ASP.NET Web Forms (Classic) 5
loading
Tags: XlsIO
Nipun Tamrakar
Asked On February 19, 2007 02:48 AM

Hello
How do i determine whether a range with specific name exists or not.

Eg. if sheet.Range("myRange").exists then

Thank you
Nipun

Melba Winshia [Syncfusion]
Replied On February 19, 2007 08:31 AM

Hi Nipun,

You can use the following code snippet to determine whether a range with specific name exists or not.

[C#]

// Naming a Range
workbook.Names.Add("One",sheet1.Range["A1"]);

//determine whether a range with specific name exists or not
if(workbook.Names.Contains("One")==true)
{
sheet1.Range["One"].Text="Hello World!";
}

Here is the sample for your reference:

Get_name.zip

Kindly take a look at the sample above and let me know if you have any other questions.

Regards,
Melba



Nipun Tamrakar
Replied On February 21, 2007 04:31 AM

Hello Melba
Thank you very much. It helped a lot

Melba Winshia [Syncfusion]
Replied On February 21, 2007 09:05 AM

Hi Nipun,

Thanks for the update!

Thanks,
Melba

Amal Ibrahim
Replied On June 23, 2008 02:10 PM

Can I do that without using the add method first?
My excel will have named range already and I don't wat to add them by code, I just want to loop through them to find specific name for example.
BTW, I am use 6.1.0.34 version.
Thanks for your help


Yavanaarasi G [Syncfusion]
Replied On June 24, 2008 04:45 AM

Hi Amal,

You have created the direct trac incident regarding this issue.

Please follow up the incident [#47333].

Regards,
G.Yavana


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.

;