Replace duplicate values - macro not working

  • Hi, could anyone tell me what I did wrong here? Macro's not working. Thank you.
    (I want to replace one of two duplicates with "0")



    Sub replace_value_in_duplicate_cells_with_zero_columnE()


    Dim rng As Range, cell As Range
    Set rng = Range("e3:e208")
    For Each cell In rng


    If ActiveCell.Value = ActiveCell.Offset(0, 1).Value Then
    ActiveCell.Offset(0, 1).Value = "0"



    End If


    Next cell


    End Sub

  • Code Tags Added
    Your post does not comply with our Forum RULES. Use code tags around code.


    Posting code between

    Code

    tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.


    Highlight your code and click the # icon at the top of your post window.


    (I have added them for you today. Please take a few minutes to read all Forum Rules and comply in the future.)

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!