Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default 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.
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Redimming an array dynamically assigned from range (how to redim first dimension of a 2-D array? /or/ reverse the original array order) Keith R[_2_] Excel Programming 3 November 13th 07 04:08 PM
Put values into excel range from single dimension array [email protected] Excel Programming 2 February 25th 06 04:33 AM
Mutli-dimensional Array to Single-Dimension Array Blue Aardvark Excel Programming 3 October 15th 05 09:22 AM
Writing Single Dimension Array to Active Sheet Fid[_2_] Excel Programming 2 June 23rd 05 09:26 PM
single dimension array RobcPettit Excel Programming 3 January 20th 04 08:33 AM


All times are GMT +1. The time now is 09:02 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"