Data Processing & Cleanup

Remove duplicates, clean data formats, and standardise entries

624 views
Featured

Perfect For:

  • Remove duplicate entries
  • Standardise text formatting
  • Clean imported data

PRO Template

Sign up for free to unlock the complete VBA code and access all templates

VBA Code (Preview)
Sign up to copy
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)

' ... 4 more lines hidden ...
'
' Sign up for free to view the complete code
' Visit: vbacode.io
Access all 45 templates
10 free AI generations/month
No credit card required

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.

Generate Custom VBA Code

Related Templates

More VBA templates in the same category

Intermediate

Create Sheet Per Unique Value

Automatically create separate worksheets for each unique value in a column. Perfect for splitting...

View Template