+ Reply to Thread
Results 1 to 14 of 14

Copy values from one woorkbook to another according to cell location

  1. #1
    Registered User
    Join Date
    04-03-2017
    Location
    Denmark
    MS-Off Ver
    365
    Posts
    92

    Copy values from one woorkbook to another according to cell location

    Hello!

    Currently what my code does is that it copies the corresponding values "value 1", "value 2" and "value 3" in regards to the respective "ID" from WorkbookA. It then pastes the values to WorkbookB in the corresponding Sheets. The code compares the ID from WorkbookA with the IDs from WorkbookBs sheets. When the ID fits it pastes the values into the respective cells. It then proceeds to the next ID (see attachments).

    What I want my code to do instead, is still to copy the values from WorkbookA into their respective places in the corresponding sheet. But the values should now be pasted into 1 column, instead of 3 (see attachment: WorksheetC). The cells for which the numbers should be copied to, are always G10, G16 and G19 for all the "Test person" sheets.

    An example: The values 5, 8 and 12 for IG1 in WorkbookA should be pasted into the cells G10, G16 and G19 respectively in WorkbookC, under sheet "Test person 1", as the IDs correspond (thus replacing the values 32, 44 and 22).

    Is there a way for the code to paste the values into their respective cells, just based on cell position?


    CODE:

    Please Login or Register  to view this content.
    Thanks!
    Attached Files Attached Files
    Last edited by Allerdrengen; 08-01-2017 at 09:06 AM. Reason: Forgot to attach code

  2. #2
    Registered User
    Join Date
    04-03-2017
    Location
    Denmark
    MS-Off Ver
    365
    Posts
    92

    Re: Modification of code

    WorkbookB should be disregarded in the new code.

  3. #3
    Registered User
    Join Date
    04-03-2017
    Location
    Denmark
    MS-Off Ver
    365
    Posts
    92

    Re: Modification of code

    Forgot to add code.

  4. #4
    Registered User
    Join Date
    04-03-2017
    Location
    Denmark
    MS-Off Ver
    365
    Posts
    92

    Re: Modification of code

    Bump, anyone?

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

    Re: Modification of code

    Give this a go....requires WorkbookA.xlsm and workbookC.xlsx to be open....
    Please Login or Register  to view this content.
    Last edited by sintek; 07-14-2017 at 11:10 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
    Registered User
    Join Date
    04-03-2017
    Location
    Denmark
    MS-Off Ver
    365
    Posts
    92

    Re: Modification of code

    Thanks for your response!

    However, when i try to run the code in, I get the error message: Runtime error '9', subscript out of range.

    Any ideas?

  7. #7
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,518

    Re: Modification of code

    Try change to
    Please Login or Register  to view this content.

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

    Re: Modification of code

    Your post does not comply with Rule 1 of our Forum RULES. Your post title should accurately and concisely describe your problem, not your anticipated solution.

    Use terms appropriate to a Google search. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will be addressed according to the OP's experience in the forum: If you have less than 10 posts, expect (and respond to) a request to change your thread title. If you have 10 or more posts, expect your post to be locked, so you can start a new thread with an appropriate title.

    To change a Title go to your first post, click EDIT then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.

    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)
    If posting code please use code tags, see here.

  9. #9
    Registered User
    Join Date
    04-03-2017
    Location
    Denmark
    MS-Off Ver
    365
    Posts
    92

    Re: Modification of code

    Sorry, changed the title.

  10. #10
    Registered User
    Join Date
    04-03-2017
    Location
    Denmark
    MS-Off Ver
    365
    Posts
    92

    Re: Modification of code

    Thanks for your reponse, but Im still getting the same error. Any suggestions ?

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

    Re: Copy values from one woorkbook to another according to cell location

    Where do you get the error?

  12. #12
    Registered User
    Join Date
    04-03-2017
    Location
    Denmark
    MS-Off Ver
    365
    Posts
    92

    Re: Copy values from one woorkbook to another according to cell location

    When running the code in WorkbookA
    Last edited by Allerdrengen; 08-03-2017 at 07:22 AM.

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

    Re: Copy values from one woorkbook to another according to cell location

    Which line of code do you get the error on and what's the error message?

  14. #14
    Registered User
    Join Date
    04-03-2017
    Location
    Denmark
    MS-Off Ver
    365
    Posts
    92

    Re: Copy values from one woorkbook to another according to cell location

    Found the error, WorkbookA was xlsx not xlsm

+ 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. VBA Code Modification
    By guapo in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-12-2014, 08:54 AM
  2. help with Code modification
    By onp in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-16-2014, 07:00 PM
  3. Little modification in code
    By mukeshbaviskar in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-18-2013, 02:15 PM
  4. code modification
    By tofimoon4 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 02-12-2010, 06:26 AM
  5. Code Modification to alert 100% and over
    By Preatorian in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-20-2009, 03:23 AM
  6. Modification to existing Code
    By Jim May in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-04-2006, 12:55 PM
  7. modification for the code
    By srinivasan in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-20-2005, 11:05 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