What is an op-ed column?

Excel vba macro to remove duplicate values in column

  • I have anspreadsheet with 2 column used, Column A and Column B. Column A Column B AA 16-18 AA 19-25 AA 25 + AB 16-18 AB 19-25 AB 25 + AC 16-18 AC 19-25 AC 25 + Is there a Macro that can be written that will remove the duplicate values from Column A, leaving the first occurrence in the cell? The spreadsheet will be ordered by Column A by default. The result should look like . . . Column A Column B AA 16-18 19-25 25 + AB 16-18 19-25 25 + AC 16-18 19-25 25 + My spreadsheet contains thousands or rows meaning I cannot realistically go through column A and just remove them myself.

  • Answer:

    Sub blankOutDuplicates() Dim rng As Range 'assuming data begins in cell A1 and continues 'down col A; first blank in col A is end of data If Range("a1") = "" Then Exit Sub If Range("a2") = "" Then Exit Sub Set rng = Range("a1").End(xlDown) Do Until rng.Row = 1 If rng.Value = rng.Offset(-1).Value Then rng.ClearContents End If Set rng = rng.Offset(-1) Loop End Sub

Miningco.com Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.