+ Reply to Thread
Results 1 to 4 of 4

Funtion to return array - shows only one variable

  1. #1
    Registered User
    Join Date
    01-10-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2007
    Posts
    11

    Funtion to return array - shows only one variable

    I defined a below fucntion in VBA as variant which got executed and is working fine however i am not able to retrieve all the values in the excel front end.

    Below is the snippet

    Please Login or Register  to view this content.

    However when i run the function from the front end

    {=Price(A1,A2,A3)} - Its returning only one value Price1 as output. What needs to be modified to get the other two values stored in the array?

  2. #2
    Registered User
    Join Date
    01-10-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Funtion to return array - shows only one variable

    If i keep the break point and do a quick watch of Price, i am able see all the three values stored in the array. I am not able to see those three values however in the front end

  3. #3
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,461

    Re: Funtion to return array - shows only one variable

    The array will not be returned to a single cell. Instead you will need to select 3 cells and array enter the formula.
    Cheers
    Andy
    www.andypope.info

  4. #4
    Registered User
    Join Date
    01-10-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Funtion to return array - shows only one variable

    Yeah. It works now.

    But only when i select the cells horizontally it is working. If i select the cells vertically its just returning the same value stored in the first array variable. Any reason for that?

  5. #5
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,461

    Re: Funtion to return array - shows only one variable

    you would need to alter the construct of your array.

    Please Login or Register  to view this content.

+ 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.6.0 RC 1