+ Reply to Thread
Results 1 to 7 of 7

Jagged Array vba

  1. #1
    Registered User
    Join Date
    07-12-2018
    Location
    In the land of TBHQ
    MS-Off Ver
    2013
    Posts
    51

    Jagged Array vba

    Hello,
    I have been trying to create an array of array or jagged array. I can't get it to work despite looking on the web for solutions.


    As an example this is what I'm trying to do:
    var_Project var_Name
    Project 1- John Peter
    Project 2 - Peter
    Project 3 - Sarah Peter John

    Then I would like to recall
    var_Project(1)(1)=John
    var_Project(2)(1)=Peter
    var_Project(3)(2)=Peter

    How would I write this in vba code.

    Thank you in advance for anyone who helps.

  2. #2
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP, 2007, 2024
    Posts
    16,519

    Re: Jagged Array vba

    I am curious what your research turned up that you found difficult to understand. I would expect something like this?
    Please Login or Register  to view this content.
    Note that I can control the lower limit for the outer varproject() array, but the inner "variants containing arrays" will default to a 0 based array, which is why I used 0 as the index for the first element of each inner array.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  3. #3
    Registered User
    Join Date
    07-12-2018
    Location
    In the land of TBHQ
    MS-Off Ver
    2013
    Posts
    51

    Re: Jagged Array vba

    Very nice. They are a couple of links that address the problem. I'm unable to post the links since I'm new to the board.
    I tried to post the question as simple as possible to get a better understanding of the basics and you did just that, explained it in a very easy way for me to understand. I really appreciate it.
    Thanks.

  4. #4
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Jagged Array vba

    Hello
    This may help you .. I suppose you have two columns of data A & B ..
    Please Login or Register  to view this content.
    < ----- Please click the little star * next to add reputation if my post helps you
    Visit Forum : From Here

  5. #5
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2019 | 2021
    Posts
    15,026

    Re: Jagged Array vba

    As wanted lol...just to be playful

    Please Login or Register  to view this content.
    Good Luck...
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the [★ Add Reputation] to left of post window...
    Also....Add a comment if you like!!!!
    And remember...Mark Thread as Solved...
    Excel Forum Rocks!!!

  6. #6
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: Jagged Array vba

    Another option !!!
    Data start "A1":- NB:- Project and names split into columns/rows as below

    var_Project var_Name
    Project 1 John Peter
    Project 2 Peter
    Project 3 Sarah Peter John


    Result start "K11"


    Please Login or Register  to view this content.
    Regards Mick
    Last edited by MickG; 07-12-2018 at 01:07 PM.

  7. #7
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,646

    Re: Jagged Array vba

    How about using a dictionary?
    If posting code please use code tags, see here.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Paste "Jagged Array" without looping
    By cmore in forum Excel Programming / VBA / Macros
    Replies: 20
    Last Post: 04-16-2017, 08:00 PM
  2. [SOLVED] Jagged Arrays: Syntax Clarificatiuon
    By cmore in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-26-2016, 05:46 PM
  3. [SOLVED] Jagged Array Excel Formula?
    By cmore in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-11-2015, 07:45 PM
  4. [SOLVED] Print to worksheet and Jagged Array
    By abousetta in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-07-2012, 07:50 PM
  5. Get error when declaring a jagged array?
    By HammerTime in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-13-2010, 11:16 PM
  6. Jagged Pie Charts
    By Sionos in forum Excel General
    Replies: 0
    Last Post: 09-25-2007, 05:54 AM
  7. [SOLVED] soften jagged edges of pie charts
    By zen in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 06-17-2005, 02:05 PM

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