Data Processing & Cleanup
Remove duplicates, clean data formats, and standardise entries
2905 views
Featured
Perfect For:
- Remove duplicate entries
- Standardise text formatting
- Clean imported data
VBA Code
Sub CleanDataRange()
Dim ws As Worksheet
Dim lastRow As Long
Dim i As Long
Set ws = ActiveSheet
lastRow = ws.Cells(ws.Rows.Count, "A").End(xlUp).Row
' Remove duplicates
ws.Range("A1:C" & lastRow).RemoveDuplicates Columns:=Array(1, 2, 3), Header:=xlYes
' Clean up text formatting
For i = 2 To lastRow
ws.Cells(i, 1).Value = Trim(UCase(ws.Cells(i, 1).Value))
ws.Cells(i, 2).Value = Trim(ws.Cells(i, 2).Value)
Next i
MsgBox "Data cleanup complete!"
End Sub
Related Topics
data
cleanup
duplicates
formatting
Need Custom VBA Solutions?
Our AI-powered VBA generator can create custom code tailored to your specific requirements in seconds.
Free AI generations every month — top up with credit packs anytime
Related Templates
More VBA templates in the same category
Intermediate
CSV Import with Data Types
Import CSV files with automatic data type detection and formatting
View Template
Intermediate
Timesheet & Attendance Tracker
Track employee working hours, overtime, absences, and holidays with automatic calculations, weekl...
View Template
Advanced
Inventory Management System
Manage stock levels with automatic reorder alerts, stock movement logging, valuation reports, and...
View Template