+ Reply to Thread
Results 1 to 7 of 7

Combine Arrays

  1. #1
    Registered User
    Join Date
    03-08-2005
    Posts
    16

    Combine Arrays

    I have cells that have comma separated data that I need to combine into a single array and then remove duplicates.

    For instance, D2 = "a,b,c", D3 = "b,c,d", D4 = "c,d,e" and I want my final array to show "b,c,d,e".

    Due to other restrictions elsewhere in my code, I need to run a loop to add in the arrays instead of selecting them as a range (the row needs to meet certain criteria to be included).

    Can anyone offer some direction on this? I did copy the functions offered at CPearson, but I am getting errors (http://www.cpearson.com/excel/VBAArrays.htm)

    Thanks in advance.

  2. #2
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,517

    Re: Combine Arrays

    Maybe this

    Please Login or Register  to view this content.
    Thanks,
    Mike

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved.

  3. #3
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    18,976

    Re: Combine Arrays

    If you are not Mac, this shoud do it.
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    03-08-2005
    Posts
    16

    Re: Combine Arrays

    These both worked well.

    Thank you so much.

    One further problem. It seems that, although my array now is gathering all of the information, I'm having a type mismatch error (run-time 13) when I'm trying to use it. The error appears at the line with "Unbound(arrStrings)"

    The next piece of code uses each element of the array to match against a cell.

    Please Login or Register  to view this content.
    Anyone got an idea what might be causing this? Went to MSDN developer site, but the information only mentioned a service pack, which I already have.

    Thanks again.

  5. #5
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,517
    Try this instead of using the join
    xItem = .items

  6. #6
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    18,976

    Re: Combine Arrays

    Quote Originally Posted by kreitzig View Post
    It seems that, although my array now is gathering all of the information, I'm having a type mismatch error (run-time 13) when I'm trying to use it. The error appears at the line with "Unbound(arrStrings)"
    Most probably arrStrins is not an Array...

  7. #7
    Registered User
    Join Date
    03-08-2005
    Posts
    16

    Re: Combine Arrays

    Quote Originally Posted by mike7952 View Post
    Try this instead of using the join
    xItem = .items
    Perfect. Thanks much. It is working good, in fact the whole complicated mess is now working correctly.

    Quote Originally Posted by jindon View Post
    Most probably arrStrins is not an Array...
    Yep, that's what i figured too. I am just a little lost because it's being loaded as an array...but I guess that's the problem.

+ 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