+ Reply to Thread
Results 1 to 10 of 10

Dim multi dimensional array

  1. #1
    Registered User
    Join Date
    01-12-2012
    Location
    Rockland, WI
    MS-Off Ver
    Excel 2016
    Posts
    56

    Dim multi dimensional array

    How do I dimension a dynamic array to contain a “text Key” in field one, and a computed double in field two, of each element?
    Last edited by jdfjab; 06-06-2012 at 09:08 AM.

  2. #2
    Valued Forum Contributor StevenM's Avatar
    Join Date
    03-23-2008
    Location
    New Lenox, IL USA
    MS-Off Ver
    2007
    Posts
    910

    Re: Dim multi dimensional array

    It is not clear what you are asking.
    Are you wanting to ReDim an array?
    Or are you wanting to create a User-defined type (with a string and double)?
    Or are you wanting a Variant array?
    (What is a "text key"?)

  3. #3
    Forum Guru shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,669

    Re: Dim multi dimensional array

    Please Login or Register  to view this content.
    Entia non sunt multiplicanda sine necessitate

  4. #4
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,417

    Re: Dim multi dimensional array

    If what you are asking is how to create a two-dimensional array with text in the first dimension (string) and number in the second dimension (double) then I would probably suggest declaring it as a variant type. Other less favorable option would be to use an array of arrays and declare each array type seperately (each dimension gets its own array).

    Hope this helps.

    abousetta
    Please consider:

    Thanking those who helped you. Click the star icon in the lower left part of the contributor's post and add Reputation.
    Cleaning up when you're done. Mark your thread [SOLVED] if you received your answer.

  5. #5
    Registered User
    Join Date
    01-12-2012
    Location
    Rockland, WI
    MS-Off Ver
    Excel 2016
    Posts
    56

    Re: Dim multi dimensional array

    Sorry if I got the terminology mixed up.
    I want to create a user-defined array with a string and double.

  6. #6
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,417

    Re: Dim multi dimensional array

    shg's example is the way to go.

  7. #7
    Registered User
    Join Date
    01-12-2012
    Location
    Rockland, WI
    MS-Off Ver
    Excel 2016
    Posts
    56

    Re: Dim multi dimensional array

    Thanks Shg,
    That gives me the starting point I was looking for.
    I'll get back to share what I end up with when it's all done.

  8. #8
    Registered User
    Join Date
    01-12-2012
    Location
    Rockland, WI
    MS-Off Ver
    Excel 2016
    Posts
    56

    Re: Dim multi dimensional array

    Shg,

    I'm back for more help. When I attempt to use the "type" code syntax:

    Please Login or Register  to view this content.
    I "loose" my procedure. Is there some "trick" I'm missing to insert the "Type" code syntax above my procedure name?

    Thanks.

  9. #9
    Valued Forum Contributor StevenM's Avatar
    Join Date
    03-23-2008
    Location
    New Lenox, IL USA
    MS-Off Ver
    2007
    Posts
    910

    Re: Dim multi dimensional array

    You type the "Type" at the beginning of a Module outside of any procedure. That way every procedure in that module can use it. If you need more than just one module to use it, you add the word Public before type. And if you want only one module to use it you can add private.

  10. #10
    Registered User
    Join Date
    01-12-2012
    Location
    Rockland, WI
    MS-Off Ver
    Excel 2016
    Posts
    56

    Re: Dim multi dimensional array

    Thanks Steven.
    Through that hurdle and on to the next.

+ 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