We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Create and Access Named Ranges in Excel spreadsheet in .NET

What if you have a named range?

PriceList is a named range with many rows of data

MaxVal is a dynamic entry from a cell used to locate a row in a table.

How do I loop through the range. How would you create a custom function with named range?

For example MyFunc(PriceList, MaxVal)

or

Range(MaxVal).Value = 34

I Also want to refer to a named range withing the enire workbook not just the worksheet.

Thank you,

Hi,

We are not clear about your requirement. Please provide some further details about what your custom function will do and how you want to utilize the parameters in the custom function.<o:p></o:p>

Thank You & Best Regards,

Sorry for not being very clear. I just want to know how to get/set a value from a named range without going through alot of extra steps. In Excel it is reletively easy, single range cell:

Dim MyString as String = xlApp.Range(MyRange).Value

or

xlApp.Range(MyRange).Value = 34

How can i get the value from a range somewhere in the workbook. You shouldn't have to know what sheet it is on. You don't have to in Excel.

Hi,

Well, I think you may try Worksheets.GetNamedRanges() method to get the named ranges and manipulate them as per your requirement. Please see the following sample code in this regard:

Dim wb As New Workbook()

Dim ranges() As Range = wb.Worksheets.GetNamedRanges()

Dim range As Range = ranges(0)

Dim value As String = range(0, 0).StringValue

For further details, please see the following document link:

https://docs.aspose.com/display/cellsnet/Create+Access+and+Copy+Named+Ranges

If you still have any query, please do let us know. We will be happy to help you out.

Thank You & Best Regards,