Macro to find Duplicates and highlight them across a workbook (9sheets)

BlackTiger

New Member
Joined
Sep 18, 2014
Messages
2
Good day,

Could anyone help me write a macro to find duplicate entries in an entire workbook.. in doing so can we isolate them via highlight. i've tried the following macro but it doesn't do what i want? Please help and Thank you in advance..

Sub myDups()
'Standard Module Code!
'Find All Duplicates on All Sheets!
Dim Message, Title, Default, SearchString
Message = "Enter your search string!" ' Set prompt.
Title = "Find ? On all sheets!" ' Set title.
Default = "" ' Set default.
' Display message, title, and default value.
SearchString = InputBox(Message, Title, Default)
Set S = Sheets.Application
myNext:
For Each S In Application.Sheets
With S.Range("A1:E700")
Set F = .Find(SearchString, MatchCase:=True, LookAt:=xlWhole, LookIn:=xlValues)
If Not F Is Nothing Then
firstAddress = F.Address
Do
S.Select
F.Select
ActiveCell.Offset(0, -1).Value = "Dup"
F.Value = SearchString
Set F = .FindNext(F)
Loop While Not F Is Nothing And F.Address <> firstAddress
End If
End With
Next S
End Sub
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.

Forum statistics

Threads
1,190,655
Messages
5,982,131
Members
439,757
Latest member
85Sarah2005

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
Top