+ Reply to Thread
Results 1 to 21 of 21

Copying specific data to different sheets

  1. #1
    Forum Contributor
    Join Date
    03-02-2018
    Location
    england
    MS-Off Ver
    2016
    Posts
    156

    Copying specific data to different sheets

    Hi,

    I was wondering is there a way to copy each rows to different sheets(100-200 rows) starting from (A2:J2), and if column F has the same number it will be copy to the same sheet. Otherwise copy it to a new sheet. For the sheet that it will be copying to it will always be copying to row(A2)

    The first sheet will have all the data and will be copy to different sheets.


    Thanks
    Attached Files Attached Files

  2. #2
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,875

    Re: Copying specific data to different sheets

    Do you want to create the different sheets or do they already exist? Do you want to name the sheets based on the contents in column F? Column F in the file you posted is currently blank. What type of data will there be in column F? Perhaps you can post an updated file that contains the data in column F.
    You can say "THANK YOU" for help received by clicking the Star symbol at the bottom left of the helper's post.
    Practice makes perfect. I'm very far from perfect so I'm still practising.

  3. #3
    Forum Contributor
    Join Date
    03-02-2018
    Location
    england
    MS-Off Ver
    2016
    Posts
    156

    Re: Copying specific data to different sheets

    Apologized, its column E. What I trying to achieve was to copy each rows from (A:J) to a sheet that ready exist in this case the first row would be copy to sheet2 then the next row would be sheet3

    For example in this case it would be (A1:J1) copying it to sheet2 then (A2:J2) to sheet2 and so on until the last row with data.

    The sheets don't need to be name based on any data in sheet1.

    Column E sometime has the same numbers and if they are the same the rows with the same numbers will be copy to the same sheet.

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

    Re: Copying specific data to different sheets

    You still don't tell us how the code should know to copy to sheet1, sheet2, sheet3 etc...
    What criteria knows which sheet is is to be copied to/
    As per Mumps1 suggestion you should upload a sample file with more info and criteria based on you actual file...
    Last edited by Sintek; 06-09-2018 at 05:25 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!!!

  5. #5
    Forum Contributor
    Join Date
    03-02-2018
    Location
    england
    MS-Off Ver
    2016
    Posts
    156
    Quote Originally Posted by sintek View Post
    You still don't tell us how the code should know to copy to sheet1, sheet2, sheet3 etc...
    What criteria knows which sheet is is to be copied to/
    As per Mumps1 suggestion you should upload a sample file with more info and criteria based on you actual file...
    Hi sintek, I don't have access to the file and PC at the moment but I will upload one when I have access to them.

    As for what criteria for which sheet there's only the criteria of column E if they are the same they will be copy to the same sheet. Otherwise, it will be copy to different sheet.

    So basically it's something like this, I would like the code to start copying sheet1 rows starting from (A2:J2) until the last row with data. Each row will be copy to a sheet that already exist starting from sheet2. They will need to be copy to the range (A2:J2) every time.

    If row1 and row2 have the same column E number it will be copy to the same sheet for this example it will be sheet2. Otherwise, row2 will be copy to the next sheet which is sheet3. Then continue this until the last row in sheet1.
    Last edited by HXIO; 06-09-2018 at 09:38 AM.

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

    Re: Copying specific data to different sheets

    Still don't get it...Upload a sample when you have time with a before & after scenario...

  7. #7
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,875

    Re: Copying specific data to different sheets

    With Sheet1 being the active sheet, try this macro. Make sure that you have enough existing sheets to equal the number of unique values in column E otherwise the macro will generate an error and some rows will not have a sheet to be copied to.
    Please Login or Register  to view this content.
    The macro assumes that you have headers in row 1 and the data starts in row 2.

  8. #8
    Forum Contributor
    Join Date
    03-02-2018
    Location
    england
    MS-Off Ver
    2016
    Posts
    156

    Re: Copying specific data to different sheets

    Hi guys, sorry for the late reply here are the updated version of the example with column F instead of column E, and an afterword example of how I want the data place to the existed sheets.
    Attached Files Attached Files

  9. #9
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,875

    Re: Copying specific data to different sheets

    Try:
    Please Login or Register  to view this content.
    Make sure you have enough existing sheets.

  10. #10
    Forum Contributor
    Join Date
    03-02-2018
    Location
    england
    MS-Off Ver
    2016
    Posts
    156

    Re: Copying specific data to different sheets

    Quote Originally Posted by Mumps1 View Post
    Try:
    Please Login or Register  to view this content.
    Make sure you have enough existing sheets.
    Hi Mumps1, thanks for the code, but it still not what I'm looking for. It copy each rows but its not copying it into the the range (A2), instead it inserted a copy after the row1. Also is it possible to use column F instead of E, because I'd try to changed it to F and error pops up thanks

  11. #11
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,875

    Re: Copying specific data to different sheets

    When I run the macro on the Example2 file you posted, the result is exactly what you showed in the Afterexample file so I'm, not sure what is not working for you. Are you testing the macro on a different file? If so, please attach a copy of that file that is not working for you.

  12. #12
    Forum Contributor
    Join Date
    03-02-2018
    Location
    england
    MS-Off Ver
    2016
    Posts
    156

    Re: Copying specific data to different sheets

    Quote Originally Posted by Mumps1 View Post
    When I run the macro on the Example2 file you posted, the result is exactly what you showed in the Afterexample file so I'm, not sure what is not working for you. Are you testing the macro on a different file? If so, please attach a copy of that file that is not working for you.
    Hi Mumps1, this is what it looks like after I run the marco on Example2 file
    Attached Files Attached Files

  13. #13
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,875

    Re: Copying specific data to different sheets

    If you compare the workbook from your Post #12 to the Afterexample workbook you posted in Post #8, you will see that they are the same. I thought that is what you wanted. If it is not what you wanted, then please post a workbook with at least a few sheets with your desired results. You may have to do this manually.

  14. #14
    Forum Contributor
    Join Date
    03-02-2018
    Location
    england
    MS-Off Ver
    2016
    Posts
    156

    Re: Copying specific data to different sheets

    Quote Originally Posted by Mumps1 View Post
    If you compare the workbook from your Post #12 to the Afterexample workbook you posted in Post #8, you will see that they are the same. I thought that is what you wanted. If it is not what you wanted, then please post a workbook with at least a few sheets with your desired results. You may have to do this manually.
    Hi Mumps1,

    Apologised, I realised where the problem is now.

    But Mumps1 I've another question if I want to use column F instead of E for the IF statement of copying the to the same sheet if they have the same column F number.

    Also is it possible to copy only from the range (A:J) instead of the whole row?

    I've included some examples

    Thanks

  15. #15
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,875

    Re: Copying specific data to different sheets

    Try:
    Please Login or Register  to view this content.

  16. #16
    Forum Contributor
    Join Date
    03-02-2018
    Location
    england
    MS-Off Ver
    2016
    Posts
    156

    Re: Copying specific data to different sheets

    Quote Originally Posted by Mumps1 View Post
    Try:
    Please Login or Register  to view this content.
    Thanks Mumps1

    It does just like how I want it, many thanks for helping me.

    If its possible can you explain to me how this code whats because I'm trying to learn and get in more depth into excel thanks

  17. #17
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,875

    Re: Copying specific data to different sheets

    You are very welcome. Here is the macro with explanatory comments. I hope this helps.
    Please Login or Register  to view this content.

  18. #18
    Forum Contributor
    Join Date
    03-02-2018
    Location
    england
    MS-Off Ver
    2016
    Posts
    156

    Re: Copying specific data to different sheets

    Hi Mumps1,

    Here's what I meant when I do this to more than 100 sheets. The pictures that had been copied sometime appear more than once in other sheets. I tried to upload the whole workbook but as its too big it won't let me here's are some examples. Are there anyway to fix this?
    Attached Files Attached Files

  19. #19
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,875

    Re: Copying specific data to different sheets

    Try making the pictures smaller or enlarge the cells so that the pictures are entirely within the cell. Also, I'm surprised that the macro didn't generate an error when you ran it. Did you get any errors? You have data starting in row 6 that wasn't in your original post. This data will give inaccurate results for the "LastRow" variable. Also you have merged cells which almost always cause problems for macros. You should avoid using merged cells at all costs.

  20. #20
    Forum Contributor
    Join Date
    03-02-2018
    Location
    england
    MS-Off Ver
    2016
    Posts
    156

    Re: Copying specific data to different sheets

    Quote Originally Posted by Mumps1 View Post
    Try making the pictures smaller or enlarge the cells so that the pictures are entirely within the cell. Also, I'm surprised that the macro didn't generate an error when you ran it. Did you get any errors? You have data starting in row 6 that wasn't in your original post. This data will give inaccurate results for the "LastRow" variable. Also you have merged cells which almost always cause problems for macros. You should avoid using merged cells at all costs.
    So far haven't encounter any errors at the moment. so I need to unmeged the cells before running this code?

  21. #21
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,875

    Re: Copying specific data to different sheets

    If the macro is working properly without any errors, then leave it as it is. If it isn't working properly then explain how it is not working. Did re-sizing the pictures solve the duplicate picture problem?

+ 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 for Copying to Specific Sheets
    By bronkista in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-08-2016, 08:57 AM
  2. [SOLVED] copying column A from specific sheets
    By ammartino44 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-28-2015, 07:18 PM
  3. copying specific data between sheets automatically
    By SarahBo in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-14-2015, 08:11 AM
  4. Copying data over to another sheets specific cells
    By cobydobbs in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 06-17-2013, 01:07 PM
  5. Copying row of data to new sheets if specific value exists in column
    By raz333 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-26-2013, 03:53 PM
  6. Replies: 17
    Last Post: 02-01-2013, 12:20 PM
  7. Replies: 0
    Last Post: 03-27-2012, 04:54 PM

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