+ Reply to Thread
Results 1 to 2 of 2

Macro to copy and paste rows of data with a given code into other preset worksheets

  1. #1
    Registered User
    Join Date
    07-08-2013
    Location
    Australia
    MS-Off Ver
    Excel 2016
    Posts
    3

    Macro to copy and paste rows of data with a given code into other preset worksheets

    Hey everyone

    I have been googling and trying to piece together as much as I can from various other questions people have asked and am not having luck in trying to create a working solution for what i am trying to do.
    Problem:
    Currently i am working with a very poorly created file that is about 80mbs, because it has too many links. I want to redesign it using a macro, but i am only just learning VBA, and examples given don't help. My problem is this, I have a set of data in one worksheet with each row having a given code eg 01, 02, 03 (multiple rows can have the same code), and i need to split that data based on these codes to each pre-existing worksheet, so eg code 01 would go to Sheet01, code 03 would go to Sheet03 etc. For each code there is a specific worksheet that all the rows with that code would need to be pasted into. I would paste a new set of data on a monthly basis and sometimes there would be a set of data that does not have any lines for a given code, in my example attached its the code 02.

    In my attached mock-up example I have only included 8 lines of data (unique code in row A) and 5 worksheets, however my actual file has thousands of lines of data and around 40 worksheets that the data needs to be pasted into.
    I feel like because of the repetitive nature of the task the set of codes can be stored in one array, the worksheets can be stored in another array and some form of a loop could filter through the data and then copy and paste all relevant lines into each corresponding worksheet. With some error check in place for any worksheets that do not have corresponding code available.

    But i just can't get that to work. any help would be appreciated.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Macro to copy and paste rows of data with a given code into other preset worksheets

    Use two macros

    One sheet specific in the Sheet Update to kick of the main macro.


    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Attached Files Attached Files
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

+ 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] Copy data rows from multiple worksheets, paste into one worksheet
    By jokris in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-20-2016, 08:59 AM
  2. VBA code to copy n rows of data and paste into every second column
    By frankbrett in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-19-2016, 03:30 PM
  3. Event triggered copy/paste data rows to program defined worksheets
    By K Rose in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-15-2015, 11:34 AM
  4. [SOLVED] Macro to compare column and copy & paste the data between 2 worksheets
    By Manish_Gupta in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-03-2014, 07:06 AM
  5. Help with Loop to copy and paste 200 rows of data into seperate worksheets
    By hawsn in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-04-2014, 09:25 PM
  6. macro to copy and paste rows at the end of data
    By jchambers00 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-15-2012, 10:41 PM
  7. Copy/Paste a preset range of cells
    By jdbel in forum Excel General
    Replies: 4
    Last Post: 10-25-2011, 06:27 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