Data Tools · VBA
Remove Duplicate Rows
Strip duplicate rows from a selected range in one click.
- Interactive range picker
- De-dupes across every column
- Keeps the first occurrence
' 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:
- Open your workbook and press Alt + F11 to open the VBA editor.
- Choose Insert ▸ Module and paste the code (or File ▸ Import File for the .bas).
- Press F5 to run, or run it from Developer ▸ Macros.
- 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