+ Reply to Thread
Results 1 to 5 of 5

Compare colunns and if do not match write row to a new sheet

  1. #1
    Forum Contributor
    Join Date
    07-31-2012
    Location
    Los Angeles, USA
    MS-Off Ver
    2003, 2010, 365
    Posts
    320

    Compare colunns and if do not match write row to a new sheet

    Hi,

    I would like to compare columns Y and AI and if they do not match, then cut that row and paste it to a new sheet.
    when the new sheet has all of the rows with Y and AI not matching I would like to save that sheet as warnings.xls and then return to the begining sheet which now only contains the matching data for columns Y and AI and save it as complete.csv.

    Thanks for any help,

    David

  2. #2
    Valued Forum Contributor AlvaroSiza's Avatar
    Join Date
    09-19-2007
    Location
    Staffordshire
    MS-Off Ver
    2007
    Posts
    591

    Re: Compare colunns and if do not match write row to a new sheet

    David, please post a sample workbook.
    Perhaps it was the Noid who should have avoided me...
    If you are satisfied with my solution click the small star icon on the left. Thanks
    1. Make a copy of your workbook and run the following code on your copy (just in case)
    2. With excel open, press ALT+F11 to open the Visual Basic Editor (VBE). From the "Insert" menu, select "Module".
    3. Paste the code from above into the empty white space. Close the VBE.
    4. From the developer tab, choose "Macros", select the Sub Name, and click "Run".

  3. #3
    Registered User
    Join Date
    04-12-2013
    Location
    Sacramento, CA
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: Compare colunns and if do not match write row to a new sheet

    Hello,

    Hope the code shows up alright... first time using the tags.

    Any rate, I tried to comment as much as possible so you understood all the various parts of the attached code, especially the parts which will require your input. Look for the commented areas with 5 x *.

    If you have any questions, let me know.... it's a bit overboard, prolly.


    Cheers,
    Xervice

    Please Login or Register  to view this content.

  4. #4
    Forum Contributor
    Join Date
    07-31-2012
    Location
    Los Angeles, USA
    MS-Off Ver
    2003, 2010, 365
    Posts
    320

    Re: Compare colunns and if do not match write row to a new sheet

    Thank you crosservice, thats works great. The only error I receive is when it tries to save the xls file. I'm using excel 2003 if that makes a difference.

    The error I get is Method 'SaveAs' of object '_Workbook' failed.

    Thanks again,

    David

  5. #5
    Forum Contributor
    Join Date
    07-31-2012
    Location
    Los Angeles, USA
    MS-Off Ver
    2003, 2010, 365
    Posts
    320

    Re: Compare colunns and if do not match write row to a new sheet

    Ok got it, changed the fileformat to x1Normal.

    Works great thanks crosservice

+ 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