Find duplicate URLs.

ahsanali32

New Member
Joined
Oct 5, 2022
Messages
1
Office Version
  1. 2016
Platform
  1. Windows
  2. MacOS

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Try this


VBA Code:
Private Sub MarkDuplicates()
    On Error Resume Next
   Dim Cl As Range
   Dim ValU As String
   Dim rng As Range
   Dim Col As String



   Col = "A" ''''''''''''''''''' This assumes that your links are in column A ... if you would like to change A to whatever you like
   With CreateObject("scripting.dictionary")
      For Each Cl In Range(Col & "2", Range(Col & Rows.Count).End(xlUp))
         ValU = Left(Cl.Value, FindPeriod(Cl.Value) - 1)
         If Not .exists(ValU) Then
            .Add ValU, Nothing
         Else
            If rng Is Nothing Then
               Set rng = Cl
            Else
               Set rng = Union(rng, Cl)
            End If
         End If
      Next Cl
   End With
   If Not rng Is Nothing Then rng.Interior.ColorIndex = 3
End Sub
Private Function FindPeriod(Str As String) As Long
    Dim i As Long, CH As String
    FindPeriod = 0
    For i = 1 To Len(Str)
        If Mid(Str, i, 1) Like "[.]" Or Mid(Str, i, 1) Like "[.]" Then
            FindPeriod = i
            Exit Function
        End If
    Next i
End Function
 
Upvote 0

Forum statistics

Threads
1,225,228
Messages
6,183,694
Members
453,181
Latest member
uspilotzzz

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top