PC Review


Reply
Thread Tools Rate Thread

Add variant arrays (without loop)

 
 
=?Utf-8?B?QmhhcmF0aCBSYWphbWFuaQ==?=
Guest
Posts: n/a
 
      9th May 2007
How to add variant arrays in one-step { without any loop }

'----
Dim arr1()
Dim arr2()
Dim Result()
Redim arr1(1 to 10, 1 to 1)
Redim arr2(1 to 10, 1 to 1)
Redim Result(1 to 10, 1 to 1)

arr1 = Range ("A1:A10")
arr2 = Range("B1:B10")

Result = arr1 + arr2
' To add Result (x) = arr1(x) + arr2(x) x=1 to 10, without a loop ?

Range("C1:C10").Value2 = Result

 
Reply With Quote
 
 
 
 
JE McGimpsey
Guest
Posts: n/a
 
      9th May 2007
One way:

With Range("C1:C10")
.Formula = "=A1+B1"
.Value = .Value
End With


In article <CDC9E1F8-FDF6-4FF3-95F3-(E-Mail Removed)>,
Bharath Rajamani <(E-Mail Removed)> wrote:

> How to add variant arrays in one-step { without any loop }
>
> '----
> Dim arr1()
> Dim arr2()
> Dim Result()
> Redim arr1(1 to 10, 1 to 1)
> Redim arr2(1 to 10, 1 to 1)
> Redim Result(1 to 10, 1 to 1)
>
> arr1 = Range ("A1:A10")
> arr2 = Range("B1:B10")
>
> Result = arr1 + arr2
> ' To add Result (x) = arr1(x) + arr2(x) x=1 to 10, without a loop ?
>
> Range("C1:C10").Value2 = Result

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
ReDim arrays in Variant Petr Danes Microsoft Excel Programming 8 11th Jun 2009 12:40 PM
1d Variant arrays? =?Utf-8?B?Sm9obiBLZWl0aA==?= Microsoft Excel Programming 3 12th Jun 2007 08:01 PM
Marshalling Variant Arrays from COM =?Utf-8?B?QW5kcmV3IFMuIEdpbGVz?= Microsoft C# .NET 0 30th Mar 2005 10:36 PM
Passing variant arrays to C/C++ dll's agarwaldvk Microsoft Excel Programming 0 18th Oct 2004 01:33 AM
VB.NET variant arrays =?Utf-8?B?Um9iIEY=?= Microsoft VB .NET 2 26th Jan 2004 11:56 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:43 AM.