+ Reply to Thread
Results 1 to 8 of 8

Compare columns in worksheets and move to correct sheet.

  1. #1
    Valued Forum Contributor
    Join Date
    02-04-2009
    Location
    Texas
    MS-Off Ver
    Excel 2016
    Posts
    665

    Compare columns in worksheets and move to correct sheet.

    I have attached a file.
    Sheet1 has a list of equipment with serial numbers in column A.
    I need to Loop through each piece of equipment and compare the Serial number to each Named Range (CompanyA) & (CompanyB) - the serial number MAY be in CompanyA Or CompanyB or neither.
    If there is a match, I would like to move the entire row to the first open row in the corresponding sheet. If no match, move to the next row.

    Some heavy lifting is done (I hope) the macro in Module1 resizes the range on sheet1 and begins a loop at the first row...
    I figure it would be easiset with Case Statements (because in the real workbook there will be about 15 tabs)
    Thank you for looking at this.
    Attached Files Attached Files
    Last edited by CRIMEDOG; 04-29-2011 at 12:26 PM.

  2. #2
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Compare columns in worksheets and move to correct sheet.

    Hi CRIMEDOG
    one of many ways
    Please Login or Register  to view this content.
    If the solution helped please donate to RSPCA

    Site worth visiting: Rabbitohs

  3. #3
    Valued Forum Contributor
    Join Date
    02-04-2009
    Location
    Texas
    MS-Off Ver
    Excel 2016
    Posts
    665

    Re: Compare columns in worksheets and move to correct sheet.

    That Works great!
    One more step - how would I have it remove the lines from Sheet1 after moving to destination - Instead of Copy, Cut & paste
    Or cycle through one more time and delete...

  4. #4
    Valued Forum Contributor
    Join Date
    02-04-2009
    Location
    Texas
    MS-Off Ver
    Excel 2016
    Posts
    665

    Re: Compare columns in worksheets and move to correct sheet.

    I tried copying the macro and modifying it to delete the row that match instead of copying
    Please Login or Register  to view this content.
    Getting error : Oblect variable or With Block variable not set
    on line
    Please Login or Register  to view this content.

  5. #5
    Valued Forum Contributor
    Join Date
    02-04-2009
    Location
    Texas
    MS-Off Ver
    Excel 2016
    Posts
    665

    Re: Compare columns in worksheets and move to correct sheet.

    Here is the file so far

    Any help would be great.
    Attached Files Attached Files

  6. #6
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Compare columns in worksheets and move to correct sheet.

    little different...
    Please Login or Register  to view this content.

  7. #7
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Compare columns in worksheets and move to correct sheet.

    Hi CRIMEDOG

    If you have many sheets it would be better to recycle the find code using arrays

    Please Login or Register  to view this content.

  8. #8
    Valued Forum Contributor
    Join Date
    02-04-2009
    Location
    Texas
    MS-Off Ver
    Excel 2016
    Posts
    665

    Re: Compare columns in worksheets and move to correct sheet.

    Works like a charm - the Array is what I am using
    Thanks

+ 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