Highlight the cell value/value

sasi

Board Regular
Joined
Jun 28, 2010
Messages
61
How can i highlight the cell value/cell when the value is repeated more than one time in column A when i run the macro
Column A
GRM155R71C104KA88D
USB3320C-EZK
TPS76318DBVT
MAX3051ESA+
ERJ-1TYF102U
RC0603FR-0749R9L
SN74AVC4T774RSVR
Column A
GRM155R71C104KA88D
USB3320C-EZK
TPS76318DBVT
GRM155R71C104KA88D
MAX3051ESA+
ERJ-1TYF102U
RC0603FR-0749R9L
SN74AVC4T774RSVR
GRM155R71C104KA88D
MAX3051ESA+
SN74AVC4T774RSVR
REpeated values may be more than one in column A,macro should take recognize all type of values numeric,alphanumeric,special characters like +_-<.>/?}]\*&^%$#@~,spaces....
Can any one provide the macro
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
What version of Excel are you using? The way to do it is by conditional formatting which is really easy with Excel 2007 onwards.
 
Upvote 0
I am using both Excel-2003 and Excel-2007, vba is the ideal way for my solution
 
Upvote 0
I am able to acheive with the following code,how to track the duplicates in columnA and show in message box.
Is it possible to recognize the Duplicate/repeated values with Cell Number, so that user can easily identify and remove the duplicates, some thing following way
The following PartNumbers are duplicated:ASD-123(Cell A5),DFG-123(Cell A45).....

Can any one help me on this.

Code:
Sub TestForDuplicates()
   Dim oCell As Range
   Dim oDuplicateCells As Range
   Dim sMsg As String
   On Error Resume Next
   For Each oCell In Intersect(Sheet2.UsedRange, Sheet2.Range("A:A")).Cells
       If Application.WorksheetFunction.CountIf(Intersect(Sheet2.UsedRange, Sheet2.Range("A:A")), oCell.Value) > 1 Then
           If oDuplicateCells Is Nothing Then
               Set oDuplicateCells = oCell
           Else
               Set oDuplicateCells = Union(oDuplicateCells, oCell)
           End If
           sMsg = sMsg & oCell.Value & ","
       End If
   Next
   If Len(sMsg) > 0 Then
       sMsg = Left(sMsg, Len(sMsg) - 1)
       oDuplicateCells.Select
       MsgBox "The following PartNumbers are duplicated: " & sMsg
   End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,590
Messages
6,179,750
Members
452,940
Latest member
rootytrip

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