![]() |
Setting Range value using a single dimension array
I am writing a VSTO addin for Excel using Visual Studio 2005. I am
attempting to set the value for a range of cells using a one dimensional string array. However, only the first string in the array is being set in each cell in the range. I've read about a Transpose function, but this is not available in the Microsoft.Office.Interop.Excel.Application class. Here's a code sample: string[] valArray = new string[3]; valArray[0] = (string)"some data 1"; valArray[1] = (string)"blah"; valArray[2] = (string)"blah 2"; Excel.Range evenRange = this.Application.get_Range("A2,A4,A6", Type.Missing); evenRange.set_Value(Type.Missing, valArray); This code puts "some data 1" in cells A2, A4,and A6. I will also need to be able to set a range containing cells in a single row, rather than a single column. Is the code for doing this any different? Thanks for any assistance. |
All times are GMT +1. The time now is 11:26 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com