+ Reply to Thread
Results 1 to 6 of 6

Deleting Duplicated Rows

  1. #1
    Forum Contributor
    Join Date
    11-07-2005
    Posts
    280

    Deleting Duplicated Rows

    Hi everyone,

    I have the following code to delete the duplicated rows depending on column B values in each row:

    Please Login or Register  to view this content.

    I would like to develop this code to check the opposite cell in Column C for each duplicated cell in Column B >>

    If the opposite cell in column D is duplicated then the row should be deleted ..

    and if the opposite cell in column D is not duplicated then the row should not be deleted

    for example:

    if the value of cell B5 is 1000
    and the value of cell B10 is 1000

    and the value of cell C5 is 5
    and the value of cell C10 is 5

    Then Row Number 5 should be deleted.

    But if the value of cell B5 is 1000
    and the value of cell B10 is 1000

    and the value of cell C5 is 5
    and the value of cell C10 is 10

    None of these two rows should be deleted

    I hope that my request and example are clear for all,

    Thanks,

  2. #2
    Forum Expert Simon Lloyd's Avatar
    Join Date
    03-02-2004
    Location
    locked in the cage
    MS-Off Ver
    All the ones my homepage shows
    Posts
    3,161
    Is the value 1000 a constant? can you post a sample workbook?
    Not all forums are the same - seek and you shall find

  3. #3
    Registered User
    Join Date
    06-20-2006
    Location
    Leeds, England
    Posts
    16
    Hi,

    Working on the logic from your code:

    Please Login or Register  to view this content.
    Would performing the same test to column C once the condition on column B has been met work:

    Please Login or Register  to view this content.
    Hope this helps.

    Ben

  4. #4
    Forum Expert
    Join Date
    11-23-2005
    Location
    Rome
    MS-Off Ver
    Ms Office 2016
    Posts
    1,628
    Attention... may be you delete rows not duplicated.

    See this example:
    RowNum....Column_B....Column_C
    ....1.............1000.............7
    ....5.............2000..............5
    ....9.............1000.............5

    You may delete row '9' because you will find duplicated values in column 'b' and in column 'C' but the row '9' is not a duplicated row.

    An alternative idea may be to use a find instruction (where to test row number).

    Regards,
    Antonio
    Last edited by antoka05; 05-09-2007 at 09:28 AM.

  5. #5
    Forum Expert
    Join Date
    11-23-2005
    Location
    Rome
    MS-Off Ver
    Ms Office 2016
    Posts
    1,628
    Try this code:

    Please Login or Register  to view this content.
    Regards,
    Antonio

  6. #6
    Forum Contributor
    Join Date
    11-07-2005
    Posts
    280
    Hi all,

    Mr. ben77 .. your code is very simple and short, but it sometimes deletes unpuplicated rows.

    Quote Originally Posted by antoka05
    Try this code:

    Please Login or Register  to view this content.
    Regards,
    Antonio
    Thank you so much Mr. antoka05 .. that is exactly what I need ..

    I added one additional row to the code in order to disable the screen updating while running the code

    I also change to row start number from 2 two 8 because my data starts from row number 8

    and my final code became as follows:

    Please Login or Register  to view this content.
    Thank you all,

+ 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