+ Reply to Thread
Results 1 to 26 of 26

Capturing data from one sheet and transferring the row to another sheet

  1. #1
    Registered User
    Join Date
    06-29-2011
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    11

    Capturing data from one sheet and transferring the row to another sheet

    Hi I hope someone can help me as I am in a right flap about this.

    I have a spreadsheet that holds information about different company's and items they have returned, all this information is on one sheet. what i need is a code, formula, macro (basically anything that will work) to be able to look at the entire sheet of information and move the relevant rows for each seperate company to a different sheet.

    A RMA 123 Orange 01.06.2011 02.06.2011 10.06.2011 11.06.2011 Orange
    B RMA 234 blue 15.06.2011 16.06.2011 24.06.2011 25.06.2011 blue
    C RMA 345 red 15.06.2011 16.06.2011 24.06.2011 25.06.2011 red
    C RMA 456 yellow 18.06.2011 19.06.2011 27.06.2011 28.06.2011 yellow
    D RMA 567 white 20.06.2011 21.06.2011 29.06.2011 30.06.2011 white
    F RMA 678 white 20.06.2011 21.06.2011 29.06.2011 30.06.2011 white
    F RMA 789 red 20.06.2011 21.06.2011 29.06.2011 30.06.2011 red
    A RMA 891 yellow 30.06.2011 01.07.2011 09.07.2011 10.07.2011 yellow
    A RMA 198 Orange 01.07.2011 02.07.2011 10.07.2011 11.07.2011 Orange

    B RMA 987 blue 05.07.2011 06.07.2011 14.07.2011 15.07.2011 blue
    E RMA 876 red 10.07.2011 11.07.2011 19.07.2011 19.07.2011 red
    E RMA 765 yellow 15.07.2011 16.07.2011 24.07.2011 25.07.2011 yellow
    E RMA 654 white 15.07.2011 16.07.2011 24.07.2011 25.07.2011 white
    E RMA 543 white 15.07.2011 16.07.2011 24.07.2011 25.07.2011 white
    B RMA 432 red 15.07.2011 16.07.2011 24.07.2011 25.07.2011 red
    C RMA 321 yellow 20.07.2011 21.07.2011 29.07.2011 30.07.2011 yellow


    So for Company A, that I have highlighted in blue, I would need all the information that is in that row to be copied, as it is seen in the main spreadsheed to the relevant sheet for that specific company, without having to copy and past every time it is entered into the main sheet. I guess I need my seperate sheets to look at the main sheet pick out their company from the first column and then pick up all the data in the rest of the row.

    Does anyone know how to do this? Any help would be greatly appreciated as I need this for a presentation that i have to do tomorrow .

    Thanking you all in advance
    Last edited by AKG1983; 06-29-2011 at 03:01 PM. Reason: Problem solved

  2. #2
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: Capturing data from one sheet and transferring the row to another sheet

    Hi AKG1983 and welcome to the forum. Perhaps it would be best if you could upload a mock workbook with mock data in it with your desired outcomes so that we can help you in time for your presentation. Especially with regards to how to set the criteria for what rows will be copied.

    Regards
    If you're happy with someone's help, click that little star at the bottom left of their post to give them Reps.

    ---Keep on Coding in the Free World---

  3. #3
    Registered User
    Join Date
    06-29-2011
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Capturing data from one sheet and transferring the row to another sheet

    Hi Mordred

    Thank you for you reply and your kind welcome.

    I will try and upload my mock spredsheet for you to have a look at. Not totally sure how to do this as never used it before but will give it a go.

    I hope all the information that I provided helps. If you need anything else just let me know.

    Thank you.

    AKG1983
    Attached Files Attached Files

  4. #4
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: Capturing data from one sheet and transferring the row to another sheet

    Hi AKG1983,

    I have a workbook to get things going for you. The only problem I see thus far with it is once the data is copied from Sheets("All Information"), it can be moved again causing duplicates. I should be able to fix that for you but I have meetings to attend to for the next little while so I have to stop for a bit. Anyhow, check it out.
    Last edited by Mordred; 06-29-2011 at 10:39 AM.

  5. #5
    Registered User
    Join Date
    06-29-2011
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Capturing data from one sheet and transferring the row to another sheet

    Hi Mordred

    thank you for your reply, unfortunately i cannot open the attachment it is telling me to contact the administrator????

    could you re-attach it for me please.

    Many thanks.

  6. #6
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: Capturing data from one sheet and transferring the row to another sheet

    Sure, we'll try again!
    Attached Files Attached Files

  7. #7
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: Capturing data from one sheet and transferring the row to another sheet

    If that doesn't work, throw the following code into a module and attach it to a button on your "All Information" sheet.
    Please Login or Register  to view this content.

  8. #8
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: Capturing data from one sheet and transferring the row to another sheet

    And I still have two minutes to get to my meeting. Try this code, if there are no new entries, the code won't move any information.
    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    06-29-2011
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Capturing data from one sheet and transferring the row to another sheet

    Hi Mordred

    That is amazing i see what you mean about the duplicates and will attempt to do as you suggested with the macro for the 'all informaton' sheet (not 100% sure how to do it though).

    Thank you for all your help with this, it is greatly appreciated.

    Many thanks
    AKG1983

  10. #10
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: Capturing data from one sheet and transferring the row to another sheet

    Hi AKG,
    I think I fixed the duplicates problem with post # 8. If not, let me know as my meeting was cancelled.

  11. #11
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: Capturing data from one sheet and transferring the row to another sheet

    Quote Originally Posted by AKG1983 View Post
    (not 100% sure how to do it though).
    AKG1983
    Do you know where to insert the code?

  12. #12
    Registered User
    Join Date
    06-29-2011
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Capturing data from one sheet and transferring the row to another sheet

    not a clue. sorry i am totally useless and using a lot of your time

  13. #13
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: Capturing data from one sheet and transferring the row to another sheet

    No need to apologize and I doubt you are useless, you just don't know (yet).
    1) Press Alt & F11 to open the Visual Basic Editor (VBE)
    2) If you are going to add the code to your own workbook, click:
    Insert > Module
    3)Copy the code from this site and paste it into the new module
    I'll let you know about how to incorporate the button if you need it but for now, lets get your code into the module.

  14. #14
    Registered User
    Join Date
    06-29-2011
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Capturing data from one sheet and transferring the row to another sheet

    Do I keep the module that is there already or do i delete or change it? When creating the new module it seems that you can put it anywhere. do i put it on one of the sub folders or the main one?

    again thank you so much for all this.

  15. #15
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: Capturing data from one sheet and transferring the row to another sheet

    If it is the workbook that I uploaded for you then you can delete the old procedure and replace it with the new one. If the workbook is yours and there is already code in it, don't delete it! I'm not sure what you mean by put it in one of the sub folders. Just place the code in the new module. If you double click (in the project window on the left side of the VBE) Sheet1(All Information) you'll see some code there for button1_Click event, that runs the code when the button is pressed.

  16. #16
    Registered User
    Join Date
    06-29-2011
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Capturing data from one sheet and transferring the row to another sheet

    everytime i add a new module it changes the other one to say the same thing. is that meant to happen?

  17. #17
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: Capturing data from one sheet and transferring the row to another sheet

    Quote Originally Posted by AKG1983 View Post
    everytime i add a new module it changes the other one to say the same thing. is that meant to happen?
    If you add another module, the module number should increment ie: Module1, Module2, and etc... You will be thrown errors if you add the same procedure into many modules because of ambiguous names so just add the procedure once. It doesn't matter whether the procedure goes into Module1, or Module2, or etc. as long as it is only pasted into one of them.

  18. #18
    Registered User
    Join Date
    06-29-2011
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Capturing data from one sheet and transferring the row to another sheet

    right done all of that and when i try and run te macro it comes up with a run time error saying 'Method 'Range' of object' _worksheet'failed

    any ideas?

  19. #19
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: Capturing data from one sheet and transferring the row to another sheet

    Save your workbook and re-upload it for me and I'll figure it out for you.

  20. #20
    Registered User
    Join Date
    06-29-2011
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Capturing data from one sheet and transferring the row to another sheet

    thank you, i appreciate this very much.
    Attached Files Attached Files

  21. #21
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: Capturing data from one sheet and transferring the row to another sheet

    It's close AKG but the catching of duplicates is evading me. I'll get it but it may take me a few minutes.

  22. #22
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: Capturing data from one sheet and transferring the row to another sheet

    I'm still trying to figure this out but I may be a little over my own head on this so I've asked for additional help.

  23. #23
    Registered User
    Join Date
    06-29-2011
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Capturing data from one sheet and transferring the row to another sheet

    thank you very much for your time on this, you are being amazingly helpful

  24. #24
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Capturing data from one sheet and transferring the row to another sheet

    AKG1983,

    Attached is a modified version of your sample workbook. It has a button titled "Split Data" which is assigned to the following macro:
    Please Login or Register  to view this content.


    Hope that helps,
    ~tigeravatar
    Attached Files Attached Files

  25. #25
    Registered User
    Join Date
    06-29-2011
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Capturing data from one sheet and transferring the row to another sheet

    You are amazing thank you so much for all your help x

  26. #26
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: Capturing data from one sheet and transferring the row to another sheet

    If you feel that your problem has been solved, please mark your thread as solved. Also, if you feel that any member has been helpful to you then don't be shy and tap their scales (located at the top right of each post).

    Regards:

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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