+ Reply to Thread
Results 1 to 6 of 6

Clear contents for consecutive duplicates in selected range

  1. #1
    Registered User
    Join Date
    01-30-2013
    Location
    CT
    MS-Off Ver
    Excel 2003
    Posts
    3

    Clear contents for consecutive duplicates in selected range

    Hello

    Trying to clear the contents of cells in range B3:N16
    where there are duplicate values on consecutive rows
    ie B4:N4 is the same as B3:N3 then clear B4:N4
    if B5:N5 is the same then clear that also
    if B6:N6 is the same then clear that too
    do not want to delete/clear the surrounding area.
    I found code that deletes the whole row but that does not help for this.
    Any thoughts/ideas welcome
    Thank You
    AM

  2. #2
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Clear contents for consecutive duplicates in selected range

    I assume you only need to compare column B not each column individually. Try:

    Please Login or Register  to view this content.

  3. #3
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Clear contents for consecutive duplicates in selected range

    Hi,

    Try this:

    Please Login or Register  to view this content.
    Directions for running the routine(s) just supplied

    Copy the code to the clipboard

    Open your Workbook

    Press ALT + F11 to open the Visual Basic Editor.

    Select “Module” from the Insert menu

    Type "Option Explicit" then paste the code into the white space on the right

    With the cursor between Sub and End Sub press F5 (F8 to Single Step)

    OR

    Press ALT + Q to close the code window.

    Press ALT + F8 then double click on the macro name
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  4. #4
    Registered User
    Join Date
    01-30-2013
    Location
    CT
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Clear contents for consecutive duplicates in selected range

    S
    Thanks for the prompt response,
    I should have stated more clearly.
    col b c d e f g h i j k l m n all have values in them
    when they are all duped in the row below then I want to clear
    all but the 1sr occurence.

    A B C D E F G H I J K L M N
    Row 3 30 30 32 33.4 1 2 3 4 5 6 7 8 9 10
    Row 4 30 30 32 33.4 1 2 3 4 5 6 7 8 9 10
    Hence row 4 cleared if row 5 the same then clear also

  5. #5
    Registered User
    Join Date
    01-30-2013
    Location
    CT
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Clear contents for consecutive duplicates in selected range

    XL

    That does the trick ! Thank you for your quick response and help with this.

    Have a great day
    AM

  6. #6
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Clear contents for consecutive duplicates in selected range

    You're welcome!

+ 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