Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

operations between arrays

Status
Not open for further replies.

jluft

Technical User
May 4, 2004
74
US
All,
I am wondering whether it is possible to perform the following

is there ONE line of code taht can create something along these lines

array1(1,2,3,4)
array2(1,2,3,4)

is there one line of code that can create a 3rd array that contains the products of the components of the 1st two arrays?
array3(1,4,9,16)

if not, what is the fastest way to do this? is a loop the only way?
thanks
 
A starting point:
array1 = Array(1, 2, 3, 4)
array2 = Array(1, 2, 3, 4)
For i = 0 To UBound(array1): array3(i) = array1(i) * array2(i): Next
Debug.Print "array3(" & Join(array3, ",") & ")"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top