Solved

Excel

Posted on 2016-11-25
3
48 Views
Last Modified: 2016-11-25
Hello,
Find  a identical   row in the excel worksheet in vba .

Cheers
0
Comment
Question by:RIAS
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 7

Accepted Solution

by:
Andy earned 500 total points
ID: 41901681
Try something like this:

Option Explicit 
Sub HighDupes() 
    Dim ws1 As Worksheet 
    Dim Row1 As Range 
    Dim Col1 As Range 
    Dim NewStr1 As String 
     'Needs reference to Microsoft Scripting Runtime
    Dim MyDic As Dictionary 
    Set MyDic = New Dictionary 
    Set ws1 = ActiveWorkbook.Sheets(1) 
    Application.ScreenUpdating = False 
    For Each Row1 In ws1.UsedRange.Rows 
         'If rows are blank then skip
        If Application.CountA(ws1.Rows(Row1.Row)) > 0 Then 
            NewStr1 = "Sheet1" 
            For Each Col1 In ws1.UsedRange.Columns 
                NewStr1 = NewStr1 & "||" & ws1.Cells(Row1.Row, Col1.Column) 
            Next 
            If MyDic.exists(NewStr1) Then 
                 'Colour intra sheet duplicates in sheet 1 as blue
                ws1.Rows(Row1.Row).Interior.Color = vbBlue 
                ws1.Rows(MyDic(NewStr1)).Interior.Color = vbRed 
            Else 
                MyDic.Add NewStr1, Row1.Row 
            End If 
        End If 
    Next 
    Application.ScreenUpdating = True 
    Set MyDic = Nothing 
    Set ws1 = Nothing 
End Sub 

Open in new window


source: http://www.vbaexpress.com/forum/showthread.php?5000-Solved-how-to-highlight-duplicate-ROWS-in-excel
0
 

Author Closing Comment

by:RIAS
ID: 41901683
Cheers Andy!
0
 
LVL 7

Expert Comment

by:Andy
ID: 41901684
A pleasure!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
Use Windows Task Scheduler to print a Word document weekly so your printer ink won't dry out.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question