+ Reply to Thread
Results 1 to 11 of 11

VBA code to copy and paste data in one sheet from multiple sheet and loop through

  1. #1
    Registered User
    Join Date
    12-14-2021
    Location
    Bangkok
    MS-Off Ver
    MS Office 365, Verision 16.55
    Posts
    52

    Thumbs up VBA code to copy and paste data in one sheet from multiple sheet and loop through

    I am trying copy data in column B for all of the sheets for 2006-2013 to all years sheet. I tried making this code which only does for one year. Is there is any way i can automate this so that the copies data from all the sheets and paste in all years according to years. I am not really that good with VBA just learning. I want to keep using xldown for the code though as it is an requirement for my work

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by Farhasnat; 12-27-2021 at 08:38 AM.

  2. #2
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: VBA code to copy and paste data in one sheet from multiple sheet and loop through

    Maybe this?
    Please Login or Register  to view this content.
    BSB

  3. #3
    Registered User
    Join Date
    12-27-2012
    Location
    Việt Nam
    MS-Off Ver
    Excel 365
    Posts
    28

    Re: VBA code to copy and paste data in one sheet from multiple sheet and loop through

    I see the sheets for 2006-2013 are the same size, maybe this code:
    Please Login or Register  to view this content.
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    12-14-2021
    Location
    Bangkok
    MS-Off Ver
    MS Office 365, Verision 16.55
    Posts
    52

    Re: VBA code to copy and paste data in one sheet from multiple sheet and loop through

    Thank you. This code works but the it repeats copying column A data repetedly also instead of pasting data horizontally it paste data after under let's say when pasting data for 2006 is done it put the ddata for 2007 right below it

  5. #5
    Registered User
    Join Date
    12-14-2021
    Location
    Bangkok
    MS-Off Ver
    MS Office 365, Verision 16.55
    Posts
    52

    Re: VBA code to copy and paste data in one sheet from multiple sheet and loop through

    Quote Originally Posted by leonguyenz View Post
    I see the sheets for 2006-2013 are the same size, maybe this code:
    Please Login or Register  to view this content.
    Thank you so much. this perfectly works !
    Last edited by Farhasnat; 12-24-2021 at 04:26 AM.

  6. #6
    Registered User
    Join Date
    12-14-2021
    Location
    Bangkok
    MS-Off Ver
    MS Office 365, Verision 16.55
    Posts
    52

    Re: VBA code to copy and paste data in one sheet from multiple sheet and loop through

    Quote Originally Posted by BadlySpelledBuoy View Post
    Maybe this?
    Please Login or Register  to view this content.
    BSB
    Thank you. This code works but the it repeats copying column A data repetedly also instead of pasting data horizontally it paste data after under let's say when pasting data for 2006 is done it put the ddata for 2007 right below it

  7. #7
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: VBA code to copy and paste data in one sheet from multiple sheet and loop through

    So you want the results pasted side by side rather in one long list?

    BSB

  8. #8
    Registered User
    Join Date
    12-14-2021
    Location
    Bangkok
    MS-Off Ver
    MS Office 365, Verision 16.55
    Posts
    52

    Re: VBA code to copy and paste data in one sheet from multiple sheet and loop through

    Quote Originally Posted by BadlySpelledBuoy View Post
    So you want the results pasted side by side rather in one long list?

    BSB
    Yes side by side only the numbers as the Column A11:A64 is same for every year. Also if I could add the year headers would be great.

  9. #9
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: VBA code to copy and paste data in one sheet from multiple sheet and loop through

    Please Login or Register  to view this content.
    BSB

  10. #10
    Registered User
    Join Date
    12-14-2021
    Location
    Bangkok
    MS-Off Ver
    MS Office 365, Verision 16.55
    Posts
    52

    Re: VBA code to copy and paste data in one sheet from multiple sheet and loop through

    Quote Originally Posted by BadlySpelledBuoy View Post
    Please Login or Register  to view this content.
    BSB
    Thank you. I just tired to understand the code you sent understood every bit of it. Thank you !

  11. #11
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: VBA code to copy and paste data in one sheet from multiple sheet and loop through

    Happy I could help.

    Thanks for the rep and don't forget to mark the thread as SOLVED if you're happy you have a working solution.

    BSB

+ 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 for Multiple sheet Pivot Table Data copy and paste to another sheet
    By neeraj1418 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-13-2021, 06:46 AM
  2. For Loop to Copy Paste Data from sheet to another
    By stein7 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-22-2019, 04:56 AM
  3. VBA code to read data and paste in other sheet using a loop.
    By aleenkhan in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 02-21-2018, 03:01 PM
  4. [SOLVED] How to write a code within a loop to copy and paste rows on to another Sheet
    By swade730 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-24-2014, 08:40 PM
  5. [SOLVED] VBA Code to copy data from one sheet and paste to multiple other sheets
    By JimmyG. in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-17-2013, 04:25 AM
  6. Replies: 1
    Last Post: 03-28-2013, 02:49 PM
  7. copy paste data with multiple selected ranges from sheet to sheet
    By sivdin in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-14-2011, 02:45 PM

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