Find duplicate URLs.

ahsanali32

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

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
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,223,952
Messages
6,175,595
Members
452,656
Latest member
earth

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