This project has moved and is read-only. For the latest updates, please go here.

Multiple Ranges

Aug 5, 2013 at 2:35 PM

do someone know how I can use something like this, cause I dont want to insert each Cell separatly?

Excel.Range r = Worksheet.Range("A3;A5;$A$29;E10")?

if I try this, I get a COM Exception,
I hope someone can help.

regards and sorry for my english

Aug 5, 2013 at 2:43 PM
looks like is localized system and you need another seperator. try "," instead of ";"

Aug 6, 2013 at 9:17 AM
ty for the fast awnser, still dont work get the same com exception.

Maybe I explained bad what i want to do.

I need the aquivalent to this vba "formula" Range("D56,F57,D61,C59,C54,D53,H54")
that is what i do in code
Excel.Range r = dataToBeWritten.Sheet.Range(dataToBeWritten.RangeString);
Sheet have the type: Excel.Worksheet

using Excel = NetOffice.ExcelApi;
Excel.Worksheet sheet;

This Exception i get: HRESULT: 0x800A03EC"
I use the new version of Netoffice

Aug 6, 2013 at 10:08 AM
k Problem solved, the COMException is throwed if in the string are "$", so first of all delete all "$" in the string and use ";" Seperator.

Aug 6, 2013 at 2:12 PM
are they any maxiama cells?
Aug 6, 2013 at 2:28 PM
Edited Aug 6, 2013 at 2:28 PM
did you mean the maximum cell number is this way? the maximum number is 2^32 as far i known and the range address string "A1,B2,...." must be <=64 in lenght.