Arithmatic operation on arrays

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

This one has to have been asked before,

I have two arrays

AAA(100), BBB(100) filled with 100 numbers,

How do I add each element in each array to each other

AAA(100) = AAA(100)+BBB(100)
so
AAA(100) = a1+b1, a2+b2, ..., a100+b100


Thanks for your help!
 
Hi Jeff,

I think that it would be necessary to loop through the two arrays, e.g.:

ArrA = ActiveSheet.Range("A1:A100").Value
ArrB = ActiveSheet.Range("B1:B100").Value

ReDim ArrC(1 To 100)

For iCtr = 1 To 100
ArrC(i) = ArrA(iCtr, 1) + ArrB(iCtr, 1)
Next i

Range("C1").Resize(100) = Application.Transpose(ArrC)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top