+ Reply to Thread
Results 1 to 7 of 7

Pass two dimentional array to a function

  1. #1
    Registered User
    Join Date
    09-13-2010
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    88

    Red face Pass two dimentional array to a function

    Hi, there
    Has anyone got an example to pass a two dimentional array to a function and return a two dimentional array back. When calling this function, how to use the value in the returned two dimentional array?

    Thanks.

    Best regards,
    Chunli
    Last edited by SpringLily; 10-08-2010 at 05:31 AM.

  2. #2
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,064

    Re: Pass two dimentional array to a function

    You pass and return it the same way as a 1D array. The only difference is that when referring to values you use myarr(x, y) rather than just myarr(x)
    Everyone who confuses correlation and causation ends up dead.

  3. #3
    Registered User
    Join Date
    09-13-2010
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    88

    Re: Pass two dimentional array to a function

    Thanks. R. The problem was a declaration confliction between the function and the main program calling it.
    How to turn off and on the autocalculation in excel while my piece of code changes the value of a cell and this cell is not related to any cells.

  4. #4
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,064

    Re: Pass two dimentional array to a function

    Why do you need to turn off calculation if your cell does not affect any others?

  5. #5
    Registered User
    Join Date
    09-13-2010
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    88

    Re: Pass two dimentional array to a function

    This is a rather big Excel sheet with several different calculations. When I am debugging my code, I found at some instances when the code changs a cells value, different part of code in the same project will be run again. An implication for turning auto-calculation off?

  6. #6
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,064

    Re: Pass two dimentional array to a function

    Could be calculation, could be event procedures. Something like:
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    09-13-2010
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    88

    Re: Pass two dimentional array to a function

    Thanks! R

+ 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