+ Reply to Thread
Results 1 to 2 of 2

Thread: vba adding arrays

  1. #1
    Jeff
    Guest

    vba adding arrays

    Hi

    I am working with a lot of arrays, and I want to be sure that I am coding
    most efficiently. I have to add multiply and divide arrays, so for example I
    want to take
    Array1(100) +5*Array2(100), but it doesnt look like I can just say

    Array3(100)=Array1(100) +5*Array2(100)
    I have to code

    For i = 1 to 100
    Array3(i)=Array1(i)+Array2(i)*5
    Next i

    Is that how you deal with arrays, by using For loops?

    Thanks for your help

  2. #2
    Bob Phillips
    Guest

    Re: vba adding arrays

    Yes, there is no array operators in VBA that I am aware of. You could dump
    them to a worksheet range, create a formula to do it, then copy the result
    back in, but for 100 elements, hardly worth the bother.

    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    "Jeff" <Jeff@discussions.microsoft.com> wrote in message
    news:063A87A2-EB26-4D75-9A47-E6D766250DFE@microsoft.com...
    > Hi
    >
    > I am working with a lot of arrays, and I want to be sure that I am coding
    > most efficiently. I have to add multiply and divide arrays, so for

    example I
    > want to take
    > Array1(100) +5*Array2(100), but it doesnt look like I can just say
    >
    > Array3(100)=Array1(100) +5*Array2(100)
    > I have to code
    >
    > For i = 1 to 100
    > Array3(i)=Array1(i)+Array2(i)*5
    > Next i
    >
    > Is that how you deal with arrays, by using For loops?
    >
    > Thanks for your help




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.2.0