if any complete row is completely same with any other row in a sheet then delete the duplicate data

if any complete row  is completely same with any other row in a sheet then delete the duplicate data
see sheet2 for the result that I need
this highlighted colour is only for understanding purpose
i have to do this by vba
Avinash SinghAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Subodh Tiwari (Neeraj)Excel & VBA ExpertCommented:
Please give this a try...
Sub DeleteDuplicateRows()
Dim lr As Long, lc As Long, i As Long
Dim x, dict
Dim str As String
Dim delRng As Range

Application.ScreenUpdating = False
lr = Cells(Rows.Count, 1).End(xlUp).Row
Set dict = CreateObject("Scripting.Dictionary")

For i = 1 To lr
    lc = Cells(i, Columns.Count).End(xlToLeft).Column
    x = Range("A" & i, Cells(i, lc)).Value
    If IsArray(x) Then
        str = Join(Application.Index(x, 1, 0), ",")
        str = x
    End If
    If Not dict.exists(str) Then
        dict.Item(str) = ""
        If delRng Is Nothing Then
            Set delRng = Cells(i, 1)
            Set delRng = Union(delRng, Cells(i, 1))
        End If
    End If
Next i
If Not delRng Is Nothing Then delRng.EntireRow.Delete
Application.ScreenUpdating = True
End Sub

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ShumsDistinguished Expert - 2017Commented:
Hi Avinash,

Try below quick VBA without loop:
Sub DelDup()
Dim Ws As Worksheet
Dim LRow As Long
Dim LCol As Integer
Set Ws = Worksheets("Sheet1")
LRow = Ws.UsedRange.Rows.Count
LCol = Ws.Cells.Find(What:="*", After:=Ws.Range("A1"), SearchOrder:=xlByColumns, SearchDirection:=xlPrevious).Column + 1
Application.ScreenUpdating = False
With Ws.Range("A1:A" & LRow)
    .AdvancedFilter xlFilterInPlace, Unique:=True
    .SpecialCells(xlCellTypeVisible).Offset(0, LCol - 1).Value = 1
    On Error Resume Next
End With
Application.ScreenUpdating = True
End Sub

Open in new window

Kindly note you need to have header column to execute above VBA
Check in attached...
Avinash SinghAuthor Commented:
Thnx Neeraj sir for ur great support  and thnx alot for giving ur precious time to this post
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

Subodh Tiwari (Neeraj)Excel & VBA ExpertCommented:
You're welcome Avinash!

Please remember to recognize the answers and queries posted other than the accepted answer also.
Experts devote their time in order to assist you and it's not fair when you don't respond to them properly.
Tell them politely why other solutions didn't work for you and why did you choose a specific answer as an accepted answer. That's a good habit and you will always get response of all the experts in your future questions. And if more than one answers work for you exactly as per your requirement, don't forget to split the points in that case.
Avinash SinghAuthor Commented:
Ok Neeraj sir in future i will not repeat this mistake again
Avinash SinghAuthor Commented:
Thnx shums sir for giving ur precious time to this post by mistakely i forgot to thnx u bcoz i just wake up in the morning and opened my pc and saw the solution actually i wasn't fresh that's why i forgot to thnx u
Subodh Tiwari (Neeraj)Excel & VBA ExpertCommented:
Thanks Avinash!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Applications

From novice to tech pro — start learning today.