Results 1 to 4 of 4

Thread: VBA - Remove Duplicate rows from an entire worksheet

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #4
    VBAX Newbie
    Joined
    Oct 2023
    Posts
    2
    Location
    I have found a solution:
    Sub RemoveDuplicates()
        Dim ws As Worksheet
        Dim rng As Range
        Dim n As Long
        Dim i As Long
        Set ws = ActiveSheet
        Set rng = ws.UsedRange
        n = rng.Columns.Count
        ReDim varArray(0 To n - 1)
        For i = 0 To n - 1
            varArray(i) = i + 1
        Next i
        ws.UsedRange.RemoveDuplicates Columns:=(varArray), Header:=xlYes
    End Sub
    Last edited by Aussiebear; 10-09-2023 at 03:15 PM. Reason: Added code tags to supplied code

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •