How to write a cell with microsoft interop

J

Jean Osorio

I have the following line:

((Microsoft.Office.Interop.Excel.Range)workSheet2.Cells[g, 3]).Value2 =
indice;

this line executed but does not do anything, the cell is no affected...

Any idea????
 
A

Alan Moseley

Without the preceeding code I cannot be certain. Are you assigning a value
to 'g', as the Cells method requires the row then column numbers rather than
its alphabetic equivalent, so maybe your code should read:-

((Microsoft.Office.Interop.Excel.Range)workSheet2.Cells[3,7]).Value2 = indice;
 
J

Jean Osorio

That's rigth

for (int g= 5102; g <= filas; g++)

Alan Moseley said:
Without the preceeding code I cannot be certain. Are you assigning a value
to 'g', as the Cells method requires the row then column numbers rather than
its alphabetic equivalent, so maybe your code should read:-

((Microsoft.Office.Interop.Excel.Range)workSheet2.Cells[3,7]).Value2 = indice;
--
Alan Moseley IT Consultancy
http://www.amitc.co.uk

If I have solved your problem, please click Yes below. Thanks.


Jean Osorio said:
I have the following line:

((Microsoft.Office.Interop.Excel.Range)workSheet2.Cells[g, 3]).Value2 =
indice;

this line executed but does not do anything, the cell is no affected...

Any idea????
 
A

Alan Moseley

According to the help screen, Value2 cannot be Currency or Date data types,
but you should still see values changing. Are you sure that you are
assigning indice a value before running your line of code?
--
Alan Moseley IT Consultancy
http://www.amitc.co.uk

If I have solved your problem, please click Yes below. Thanks.


Jean Osorio said:
That's rigth

for (int g= 5102; g <= filas; g++)

Alan Moseley said:
Without the preceeding code I cannot be certain. Are you assigning a value
to 'g', as the Cells method requires the row then column numbers rather than
its alphabetic equivalent, so maybe your code should read:-

((Microsoft.Office.Interop.Excel.Range)workSheet2.Cells[3,7]).Value2 = indice;
--
Alan Moseley IT Consultancy
http://www.amitc.co.uk

If I have solved your problem, please click Yes below. Thanks.


Jean Osorio said:
I have the following line:

((Microsoft.Office.Interop.Excel.Range)workSheet2.Cells[g, 3]).Value2 =
indice;

this line executed but does not do anything, the cell is no affected...

Any idea????
 
P

Patrick Molloy

what value does 'indice' have??

Jean Osorio said:
That's rigth

for (int g= 5102; g <= filas; g++)

Alan Moseley said:
Without the preceeding code I cannot be certain. Are you assigning a
value
to 'g', as the Cells method requires the row then column numbers rather
than
its alphabetic equivalent, so maybe your code should read:-

((Microsoft.Office.Interop.Excel.Range)workSheet2.Cells[3,7]).Value2 =
indice;
--
Alan Moseley IT Consultancy
http://www.amitc.co.uk

If I have solved your problem, please click Yes below. Thanks.


Jean Osorio said:
I have the following line:

((Microsoft.Office.Interop.Excel.Range)workSheet2.Cells[g, 3]).Value2 =
indice;

this line executed but does not do anything, the cell is no affected...

Any idea????
 
Top