View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Alan Beban Alan Beban is offline
external usenet poster
 
Posts: 200
Default find the index number for an array element

If

Sub test1()
Dim arr
arr = Range("a1:c3")
arr1 = Application.Index(arr, 0, 1)
arr2 = Application.Index(arr, 0, 2)
arr_result = ArrayAdd(arr1, arr2, False)
End Sub

The looping is built in to the function.

Alan Beban

Peter Bernadyne wrote:
By the way, is it possible to perform an operation on 2 vectors such as
arr1 and arr2 in this example? For instance, would it be possible to
create:

arr_result = arr1 - arr2

consisting of the differences between each individual element of arr1 &
arr2 all in one fell swoop or do you have to loop through such a thing?

Any advice much welcomed.

-Pete