+ Reply to Thread
Results 1 to 2 of 2

Compare Range list with String Array list (both same # of values)

  1. #1
    Registered User
    Join Date
    06-07-2016
    Location
    Aberdeen,UK
    MS-Off Ver
    Windows 7
    Posts
    1

    Compare Range list with String Array list (both same # of values)

    Hi, here is my problem.

    The following code shows two separate lists of strings stored as arrays (arrOne & arrTwo). I read both arrays into a 2 dimensional array (arrDestination) and print out the results;

    Please Login or Register  to view this content.
    Output:

    Please Login or Register  to view this content.
    This works, but what I'd really like to do is store a range of values from the worksheet into the second array (arrTwo). I've tried inserting the following code lines which stores 4 values from A1 - D1;

    Please Login or Register  to view this content.
    The last line is replaces the previous arrTwo array. I've tried other ways of storing the range into the array, but when it comes to running the macro I either get errors with how the array is stored, or errors which seem to suggest the 2D array can not read the values.

    I would also like to do a comparison on the final 2D array and output a msg stating if all rows of the 2D array match or not. Appologies if this has been covered, I did have a good look through the forum.

    Would appreciate any help
    Regards

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Compare Range list with String Array list (both same # of values)

    You can not split myArray = Range("A1:D1").Value as you do not have a separator. You loaded a range in to an array. If you want to access the elements within the array, you need to loop through the array. Each element has an index number.

    For instance.

    For each arrayindex in myArray
    magbox=myArray (arrayindex)

    Next

+ 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: 2
    Last Post: 12-29-2014, 11:24 PM
  2. Replies: 4
    Last Post: 12-23-2013, 08:43 AM
  3. Replies: 5
    Last Post: 10-26-2013, 01:03 PM
  4. [SOLVED] How to Compare a string of text between two cells and list out the differences?
    By cathchin in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-23-2012, 09:26 PM
  5. search for a part of string within an array of strings from another array list
    By jdonohue in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-12-2011, 01:32 PM
  6. compare to a list of array
    By okl in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-03-2009, 12:36 PM
  7. [SOLVED] Compare a value to a list of values
    By Jamie in forum Excel General
    Replies: 1
    Last Post: 07-08-2006, 10:55 AM

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