Data Tools · VBA

Remove Duplicate Rows

Strip duplicate rows from a selected range in one click.

download.bas (ES) download.bas (EN)
' Removes duplicate rows from a selected range based on all columns.
Sub RemoveDuplicateRows()
    Dim rng As Range, cols() As Variant, i As Long
    On Error Resume Next
    Set rng = Application.InputBox("Select the range (including headers):", _
                                   "Remove Duplicates", Selection.Address, Type:=8)
    On Error GoTo 0
    If rng Is Nothing Then Exit Sub

    ReDim cols(0 To rng.Columns.Count - 1)
    For i = 0 To rng.Columns.Count - 1
        cols(i) = i + 1
    Next i

    rng.RemoveDuplicates Columns:=(cols), Header:=xlYes
    MsgBox "Duplicate rows removed.", vbInformation
End Sub

Free to use and modify · ExcelBot — excelempowers.com

Prompts you to select a range (with headers) and removes duplicate rows across all columns.

How to install:

  1. Open your workbook and press Alt + F11 to open the VBA editor.
  2. Choose Insert ▸ Module and paste the code (or File ▸ Import File for the .bas).
  3. Press F5 to run, or run it from Developer ▸ Macros.
  4. Save your file as .xlsm (macro-enabled) to keep the macro.

No VBA? In ExcelBot you can do the same thing by just asking the AI in plain language.

remove duplicates clean data vba duplicados limpieza
Rather not use VBA?

In ExcelBot you get the same result by asking the AI in plain language — no macros needed.

Try ExcelBot free Browse more macros

Related macros