Hi
I have two set of data in column A and B. in column A it has short form text, in B it has long form text.
how can I compare the text in A against B containing the same text in A and highlight it.
for example
column A column B
123 st123er A1 should be highlighted
a23c sefa23c ver A2 should be highlighted
45 wrse23 A3 should not be highlighted
123 rwet A4 should be highlighted
please reference the code below for my exact compare
Sub Comp_highlight()
Dim OrgRg
Dim ToCompRg
Dim x As Integer
Dim oCell
Dim cCell
‘set orginal range to compare
Range(“A1”).Select
Set OrgRg = Range(ActiveCell, ActiveCell.End(xlDown))
‘Reset Colors
OrgRg.Interior.ColorIndex = xlNone
OrgRg.Font.ColorIndex = 0
‘set other data to compare range
Range(“B1”).Activate
Set ToCompRg = Range(ActiveCell, ActiveCell.End(xlDown))
Application.ScreenUpdating = False
‘Compare NOW
For Each oCell In OrgRg
For Each cCell In ToCompRg
If oCell = cCell Then ‘how to change the code something like if cCell “contain” oCell Then
‘MsgBox oCell.Text & “:” & cCell
With oCell.Interior
.ColorIndex = 15 ‘grey
.Pattern = xlSolid
End With
End If
Next cCell
Next oCell
Application.ScreenUpdating = True
MsgBox “Completed comparison”
End Sub