Keenora Fluffball
Keenora Fluffball

Reputation: 1686

Getting the Range of a named area in Excel via C#.net

I've got the following problem. I've got a Excel 2010 file with n-sheets. In one of these sheets I made some table. Like, entering something like this:

Name  Date RandomValue
 Max 09.03         585
 Tim 11.05       1A442

Now, we've got this option in Excel to format a specific area to a table. So the header row get a little sorter for each column and maybe a sum-row at the bottom and stuff like that. Now, I want to get this area. Basically the task is, to add a row at the bottom (of course before the sum-row) of the table.

So for this I need the boundaries. If I click on the Name-Manager in Excel, it gives me an overview about the defined names in the sheet. And when I click on it, it selects the given area. So, there are those information for sure. The problem is just...to get these values. Any ideas?

Upvotes: 1

Views: 5862

Answers (1)

Keenora Fluffball
Keenora Fluffball

Reputation: 1686

I found a solution. The get_Range() function accept names aswell. So I can get the whole table area:

Range rng = myExcelWorksheet.get_Range("Tablename", misValue); 

I just get the last row, and the first and last cell. So its possible to add a new row. Thanks for the help anyway!

Upvotes: 5

Related Questions