Results 1 to 7 of 7

Clear (not Delete) Duplicate Values in Column

Threaded View

cda Clear (not Delete) Duplicate... 12-14-2010, 11:06 AM
TMS Re: Clear (not Delete)... 12-14-2010, 11:31 AM
Marcol Re: Clear (not Delete)... 12-14-2010, 11:32 AM
StephenR Re: Clear (not Delete)... 12-14-2010, 11:32 AM
martinleyland Re: Clear (not Delete)... 12-14-2010, 11:37 AM
martinleyland Re: Clear (not Delete)... 12-14-2010, 11:39 AM
cda Re: Clear (not Delete)... 12-14-2010, 12:02 PM
  1. #1
    Registered User
    Join Date
    10-22-2010
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    15

    Clear (not Delete) Duplicate Values in Column

    I feel stupid asking this question - it should be easy but I keep getting a "variable required - can't assign to this expression" error.

    I'm trying to evaluate cells in column B. If the value in cell B3 is the same as the value in B2, clear the value in A3 and B3. If the value in cell B4 is the same as B3, clear A4 and B4, and so on until the last cell of the range. Here is what I came up with:

    Sub clearDuplicates()
    Set Rng = ActiveCell.Value
    Set Prev = ActiveCell.Offset(-1, 0)
    
    Worksheets("source").Activate
    
    For Each ActiveCell.Cells.Value In Rng
        If Rng = Prev Then
            ActiveCell.Value.ClearContents
            ActiveCell.Offset(0, -1).ClearContents
        Next
    End Sub
    I've attached a file that has the original data in one worksheet (source), then the desired result in another (result).

    Thanks for any guidance you can provide.
    Attached Files Attached Files
    Last edited by cda; 12-14-2010 at 12:05 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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