C# Excel: Creating a named range?
-
How can I create a named range in a C# excel report for cells that aren't lined up next to eachother? I've seen examples on how to create a named range for consecutive cells (i.e. A1:M1), however the cells I need to name are scattered throughout the report (i.e. A1, H3, J9, S17, etc). In excel, I could just do this by holding CTRL + click, but how can I do this in c#? Thanks.
-
How can I create a named range in a C# excel report for cells that aren't lined up next to eachother? I've seen examples on how to create a named range for consecutive cells (i.e. A1:M1), however the cells I need to name are scattered throughout the report (i.e. A1, H3, J9, S17, etc). In excel, I could just do this by holding CTRL + click, but how can I do this in c#? Thanks.
You can Create list of Range insted
List<Range> myrng = new List<Range>(20); myrng.Add(excelWorksheet.get\_Range("A1", "B3"));
and for one cell use Range like this:
Range rng1 = excelWorksheet.get_Range("A1", "A1");
then set property of each in loop