This project has moved. For the latest updates, please go here.

Multiple Ranges

Aug 5, 2013 at 1:35 PM
Hey,

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

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

Sebastian
Aug 6, 2013 at 8: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


regards
Aug 6, 2013 at 9: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.

Ty
Aug 6, 2013 at 1:12 PM
are they any maxiama cells?
Coordinator
Aug 6, 2013 at 1:28 PM
Edited Aug 6, 2013 at 1: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.

Sebastian