+ Reply to Thread
Results 1 to 2 of 2

Print every element in multidimentional array

  1. #1
    Registered User
    Join Date
    03-19-2014
    Location
    Seattle, Wa
    MS-Off Ver
    Excel 2010
    Posts
    1

    Print every element in multidimentional array

    Hi,

    I have 9 named ranges on worksheet Sheet1. I want to print every combination of every non-singular range on worksheet Sheet2. Below is a simplified version of the scenario.

    There are three named ranges: Letters, Colors, Animals. Say the below are the entries for each range.
    Letters = {A, B, C}
    Colors = {Red, Blue}
    Animals = {Dog}
    I want to print every combination of Letters and Colors but exclude Animals since it only has 1 entry. Therefore my result would look something like this:
    A Red
    B Red
    C Red
    A Blue
    B Blue
    C Blue
    My thought is to make a multidimentional array GrandArray where GrandArray(1) = Letters and GrandArray(2) = Colors, then recursively go back through every combination and print to Sheet 2. I can set up GrandArray, but stepping through each element is creating mismatch errors.

    I'm trying to avoid For loops since my real data has 9 ranges which may or may not be included in the final print. Can anyone give some advice?

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

    Re: Print every element in multidimentional array

    There's a workbook at https://app.box.com/s/47b28f19d794b25511be that will do that.
    Entia non sunt multiplicanda sine necessitate

+ 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. Replies: 12
    Last Post: 01-14-2014, 01:56 PM
  2. [SOLVED] Read last element of Split array and then discard it and resize the array.
    By staggers47 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-28-2012, 06:36 PM
  3. [SOLVED] Returning an array specific to an element of a separate array
    By peterszabla in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-24-2012, 05:30 PM
  4. Array problem: Key words-Variant Array, single-element, type mismatch error
    By davidm in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-09-2005, 01:54 AM
  5. Array problem: Key words-Variant Array, single-element, type mismatch error
    By davidm in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-08-2005, 12:30 AM

Tags for this Thread

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