+ Reply to Thread
Results 1 to 11 of 11

Assigning values from 1 wb to another using arrays

  1. #1
    Forum Contributor
    Join Date
    10-08-2019
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    326

    Assigning values from 1 wb to another using arrays

    hi

    I'm just trying to assign values from Book1 to Book2 but my code isn't working and I don't know where i got it wrong. I don't know if it has to do with my declaration , if the syntax is even correctly put.

    Attached are the samples and code, if anyone could take a look & give me a hand with it, really appreciate it.


    Stewart
    Attached Files Attached Files

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Assigning values from 1 wb to another using arrays

    This code is way overcomplicated for what you want to do. The only thing not clear to me, and I don't have the time to reverse engineer all of your code, is where you want the data to be put in Book2. It would be very helpful to show what result you want. As it is, your Book2 is just blank.

    For example, to copy the data from Book1 to start in A1 of Book2:
    Please Login or Register  to view this content.
    What you actually want will probably be just as simple unless you want some unusual mapping.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Forum Contributor
    Join Date
    10-08-2019
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    326

    Re: Assigning values from 1 wb to another using arrays

    hi 6StringJazzer

    here's the result i hope to achieve in Book2, sorry i didn't include this in my 1st post. The sequence is the same as mentioned in my draft code

    Stewart
    Attached Files Attached Files

  4. #4
    Forum Contributor Dante Amor's Avatar
    Join Date
    07-24-2020
    Location
    MEXICO
    MS-Off Ver
    Excel 2013
    Posts
    212

    Re: Assigning values from 1 wb to another using arrays

    Try this:

    Please Login or Register  to view this content.

  5. #5
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,236

    Re: Assigning values from 1 wb to another using arrays

    Another Option...Non Looping...
    Please Login or Register  to view this content.
    If there is no data between these two resultant outputs, then the above can be simplified...
    Last edited by sintek; 06-12-2022 at 05:53 AM.
    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 star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  6. #6
    Forum Contributor
    Join Date
    10-08-2019
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    326

    Re: Assigning values from 1 wb to another using arrays

    the code works a charm, thanks Dante

    Stewart

  7. #7
    Forum Contributor
    Join Date
    10-08-2019
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    326

    Re: Assigning values from 1 wb to another using arrays

    hey sintek,

    i tried to apply your loop-free code but i think maybe because you had set a limit to the last row (though I couldn't locate where), when I expand the data size (downward add rows), your code does not include them beyond my sample last row and the additional data do not get assigned to Book2. The sample wb Book1 was just a simplified book as the actual data population is much larger

    Could you let me know where that limit is so i can try to apply your code again ? I'm hoping to test for the much larger data population, your loop-free is always good

    Stewart

  8. #8
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,236

    Re: Assigning values from 1 wb to another using arrays

    Please Login or Register  to view this content.

  9. #9
    Forum Contributor
    Join Date
    10-08-2019
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    326

    Re: Assigning values from 1 wb to another using arrays

    That's marvellous Sintek

    thanks again,
    Stewart

  10. #10
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,236

    Re: Assigning values from 1 wb to another using arrays

    Glad to have contributed...Tx for rep +

  11. #11
    Forum Contributor Dante Amor's Avatar
    Join Date
    07-24-2020
    Location
    MEXICO
    MS-Off Ver
    Excel 2013
    Posts
    212

    Re: Assigning values from 1 wb to another using arrays

    Glad we could help & thanks for the feedback

+ 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] Querying Large Series of Arrays And Displaying Unique Values in Arrays [Hard Index Match?]
    By larryg003 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-28-2020, 04:52 PM
  2. Assigning non-uniform arrays to multi dimension array
    By roldy in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 12-20-2018, 04:15 PM
  3. Assigning variable to a cell's location by looping through 2 different arrays
    By excelicus in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-16-2018, 05:09 AM
  4. [SOLVED] Declaring and assigning values to arrays
    By shoulddt in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-19-2017, 08:36 PM
  5. [SOLVED] Type Mismatch when assigning data from ranges (columns) to arrays
    By seigna in forum Excel Programming / VBA / Macros
    Replies: 32
    Last Post: 05-07-2013, 07:40 AM
  6. assigning multidimensional arrays and then using Ubound.........i am using it wrong.
    By welchs101 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 12-08-2011, 04:43 PM
  7. Assigning/Retrieving arrays of values to/from listobjects
    By jarrods in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-08-2009, 08:20 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