+ Reply to Thread
Results 1 to 14 of 14

compare data and move it to new sheet

  1. #1
    Registered User
    Join Date
    09-03-2005
    Posts
    57

    compare data and move it to new sheet

    Hi, I'm new to VBA. and can any one assist me to have vba cod that can do the following.


    \1


    1. I need to compare data by "Item No" in both Sheets " sheet1 and sheet2" and move any duplicated rows to a new sheet "Sheet3".
    2 . in sheet three I need it to sort the data by "Item No"

    I will be appreciate any assist.
    Regards
    Attached Images Attached Images

  2. #2
    Forum Expert Vikas_Gautam's Avatar
    Join Date
    06-04-2013
    Location
    Ludhiana,Punjab, India
    MS-Off Ver
    Excel 2013
    Posts
    1,850

    Re: compare data and move it to new sheet

    Try the following code...

    Please Login or Register  to view this content.
    Before running this code.. make a new worksheet "sheet3"


    Don't forget, click *
    Last edited by Vikas_Gautam; 07-19-2014 at 12:13 AM.

  3. #3
    Registered User
    Join Date
    09-03-2005
    Posts
    57

    Re: compare data and move it to new sheet

    Hi Vikas_Gautam.

    thank you for your reply.
    I'm getting 1004 error.

    I don't what is the rong?

  4. #4
    Forum Expert Vikas_Gautam's Avatar
    Join Date
    06-04-2013
    Location
    Ludhiana,Punjab, India
    MS-Off Ver
    Excel 2013
    Posts
    1,850

    Re: compare data and move it to new sheet

    Sorry I am replaying late..

    but you have to use helper columns..
    first you have to list unique column ..
    using following formula in A21..

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    use ctrl + shift + enter to enter the formula..
    and drag it down..
    you will get a unique cell list...
    after that..
    count the occurrence of each of the unique cell...
    by using following formula in B21..

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    drag it down..

    do this for both the sheet..

    then use following code to move the duplicates..

    Please Login or Register  to view this content.
    Don't forget to click *

  5. #5
    Registered User
    Join Date
    09-03-2005
    Posts
    57

    Re: compare data and move it to new sheet

    Hi Vikas_Gautam

    Thank you very much.

    I'm getting error with that formula.

    I have upload the file can you pls add the formula to it.

    Regards
    Attached Files Attached Files

  6. #6
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: compare data and move it to new sheet

    Hi Savio,
    Try the attached
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    09-03-2005
    Posts
    57

    Re: compare data and move it to new sheet

    Hi AB33

    Thank you very much for your assistance you really help me a lots.

    One things still needed.

    I need to add new Column to show sheets name which the copy was made from.

    Please see the attached file sheet3
    Attached Files Attached Files

  8. #8
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: compare data and move it to new sheet

    Update code:
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    09-03-2005
    Posts
    57

    Re: compare data and move it to new sheet

    thank you very much Dear AB33

  10. #10
    Registered User
    Join Date
    09-03-2005
    Posts
    57

    Re: compare data and move it to new sheet

    Hi ab33

    How can I make read the sheet name as i name it, not sheet1 or sheet2 for ex: I named sheet1 to Items and i named sheet2 to Qu

    Thanks again

  11. #11
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: compare data and move it to new sheet

    sheet1 and sheet2 are in parenthesis on the code "", change them in what ever you like.
    Y(k, j) = "Sheet2"

  12. #12
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: compare data and move it to new sheet

    I have now updated the code. The sheet names for the entire code will be picked up from the 1st 3 top rows. All you have to do is change the names on the 3 lines. The code will do the rest.
    Attached Files Attached Files

  13. #13
    Registered User
    Join Date
    09-03-2005
    Posts
    57

    Re: compare data and move it to new sheet

    Hi,

    Could you please modify the code to create new sheet for duplicate cell automatically with the name "Items Duplicate"

    All the best

  14. #14
    Registered User
    Join Date
    09-03-2005
    Posts
    57

    Re: compare data and move it to new sheet

    Hi
    any one can help

+ 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] Compare 2 sheets and move unmatched to sheet 3
    By JAYRUES in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-12-2012, 07:07 AM
  2. Compare columns in worksheets and move to correct sheet.
    By CRIMEDOG in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-29-2011, 12:25 PM
  3. Loop through cells compare values add and move to another sheet
    By begilhang in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-22-2010, 04:07 AM
  4. How to identify text (compare) in one sheet, then move it another
    By mag7417 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-14-2005, 10:54 AM

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