+ Reply to Thread
Results 1 to 5 of 5

VBA that removes duplicate rows

  1. #1
    Registered User
    Join Date
    04-09-2007
    Posts
    3

    VBA that removes duplicate rows

    I am a novice when it comes to VBA but I have written a subroutine that outputs exactly the data I want in many rows. The only problem is that some of the rows are repeats and so I would like to add a little more VBA code to remove the duplicate rows without the need of a filter.

    Thus
    if the output was originally
    2.....4.....6.....8.....10.....3.....9
    2.....4.....6.....8.....10.....3.....9
    8.....3.....6.....8.....10.....3.....9
    8.....3.....6.....8.....10.....3.....9
    5.....3.....6.....7.....10.....3.....9
    5.....3.....6.....7.....10.....3.....8
    2.....4.....6.....8.....10.....3.....9

    All that should be output is
    2.....4.....6.....8.....10.....3.....9
    8.....3.....6.....8.....10.....3.....9
    5.....3.....6.....7.....10.....3.....9
    5.....3.....6.....7.....10.....3.....8


    Please advise.

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,482
    http://www.cpearson.com/excel/deleting.htm

  3. #3
    Registered User
    Join Date
    04-09-2007
    Posts
    3

    Unique rows in subroutine output

    Hi Dave,

    Thank you for the prompt reply and the link.

    It is interesting but I don't think the methods do quite what I had in mind.

    I am hoping to add VBA to my subroutine, so that only unique rows are output.

    Each row is of the same width (has the same number of columns).

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Why not use Advanced Filter to create a new list then delete the old one?

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

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  5. #5
    Registered User
    Join Date
    04-09-2007
    Posts
    3

    Success

    Hi Roy

    That is just what I wanted.
    Thank you.

    ps
    For some reason I get no duplicates except that the first and last row are identical - but that's good enough for me.

+ 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