Solved

Excel

Posted on 2016-11-25
3
51 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
This article describes a serious pitfall that can happen when deleting shapes using VBA.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.

705 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