2

I used Excel.Range.Value but it writes the same value to all the columns' cells.

object[] weights = new object[10000];

Excel.Range startCell = (Excel.Range)worksheet.Cells[2, cols+1];
Excel.Range endCell = (Excel.Range)worksheet.Cells[rows, cols+1];
Excel.Range writeRange = worksheet.get_Range(startCell,endCell);
writeRange.Value = weights;
3
  • I used the Excel.Range and it worked , but all the columns'cells have the same value. Note: array weights contains different values Commented May 22, 2013 at 11:13
  • You mean all your cells contain weights[0] Commented May 22, 2013 at 11:14
  • So it didn't really "work" and you have the same problem as the guy that asked the other question. Go check it out ;) Commented May 22, 2013 at 11:18

1 Answer 1

2

The Range.Value property takes a 2D Object for non-scalar values.

Sign up to request clarification or add additional context in comments.

7 Comments

That code is Visual Basic and we're on C# here.
I've removed the code example but the Range.Value data type still stands.
... thus turning it into a comment at best.
Disagree. It's the right answer.
But a very vague and incomplete one, especially comparing to the one in the linked question :) I'll give you an upvote however.
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.