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.
Bookmarks