hi mahesh... though i have already sent a code... you can use the code below... it would serve the purpose in a better way..
============================================ Sub highlight_duplicate() Dim vClmn(1 To 2) As Range Dim vCnctnt_Values() As String Dim vCells As Range Dim vRows_Count As Integer Dim vColor() As Integer Set vClmn(1) = Range([b2], [b2].End(xlDown)) Set vClmn(2) = Range([c2], [c2].End(xlDown)) vRows_Count = vClmn(1).Count ReDim vCnctnt_Values(vRows_Count) ReDim vColor(vRows_Count) Dim vColor_Index As Integer For x = 1 To vRows_Count vColor(x) = 0 Next For x = 1 To vRows_Count vCnctnt_Values(x) = vClmn(1)(x) & vClmn(2)(x) ' MsgBox vCnctnt_Values(x) Next vColor_Index = 4 'Stop For x = 1 To vRows_Count vClmn(1)(x).Select Stop flag = 0 If vColor(x) = 0 Then vClmn(1)(x).Select For n = x + 1 To vRows_Count If vCnctnt_Values(x) = vCnctnt_Values(n) Then vClmn(1)(n).Select ' MsgBox "found match" vColor(x) = vColor_Index vColor(n) = vColor_Index flag = 1 vClmn(2)(x).Offset(0, 1).Value = vColor(x) vClmn(2)(n).Offset(0, 1).Value = vColor(n) End If Next If flag = 1 Then vColor_Index = vColor_Index + 1 End If End If Next Stop For x = 1 To vRows_Count If vColor(x) <> 0 Then vClmn(1)(x).Interior.ColorIndex = vColor(x) vClmn(2)(x).Interior.ColorIndex = vColor(x) End If Next End Sub ======================================== Thanks and Regards, Vivek Agrawal Skype ID - vivek.agrawal83 GoogleMoonlight.com - Saving energy-Save Earth On Thu, Jul 23, 2009 at 12:51 PM, Mahesh <mahender.bi...@gmail.com> wrote: > Hi vivek, > > I want that if both columns are same then it will be highlighted else not. > > Example:- > > A B > 1 12N0044 076E5920 2 12N0648 076E5920 3 12N0650 076E4039 4 12N0650 > 076E4039 > > As u see in above example > > B1 & B2 are same but they not highlited, but A3 & B3: A4 & B4 Are highlited > as the both contain same value.... > > hope this will clear my query... > > > On Thu, Jul 23, 2009 at 10:32 AM, vivek agrawal <vivek.agrawa...@gmail.com > > wrote: > >> hi mahesh >> The requirement is still not clear... >> >> can u please explain which values u want to compare and in what manner to >> highlight >> >> Thanks and Regards, >> Vivek Agrawal >> Skype ID - vivek.agrawal83 >> >> GoogleMoonlight.com - Saving energy-Save Earth >> >> >> >> >> On Thu, Jul 23, 2009 at 9:20 AM, Mahesh <mahender.bi...@gmail.com> wrote: >> >>> Hi All, >>> >>> Need a solution here. >>> >>> attached is the sheet contain data in Column B &C. >>> >>> What i need is, if the data in both column are same then it will be >>> highlighted. >>> >>> Example:- >>> >>> 1 12N0044 076E5920 2 12N0648 076E5920 3 12N0650 076E4039 4 >>> 12N0650 076E4039 >>> >>> >>> -- >>> With Love, >>> Mahesh Bisht >>> >>> >>> >> >> > > > -- > With Love, > Mahesh Bisht > > > > --~--~---------~--~----~------------~-------~--~----~ ---------------------------------------------------------------------------------- Some important links for excel users: 1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at http://www.excelitems.com 2. Excel tutorials at http://www.excel-macros.blogspot.com 3. Learn VBA Macros at http://www.vbamacros.blogspot.com 4. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com If you find any spam message in the group, please send an email to: Ayush Jain @ jainayus...@gmail.com or Ashish Jain @ 26may.1...@gmail.com <><><><><><><><><><><><><><><><><><><><><><> HELP US GROW !! We reach over 5,000 subscribers worldwide and receive many nice notes about the learning and support from the group. Our goal is to have 10,000 subscribers by the end of 2009. Let friends and co-workers know they can subscribe to group at http://groups.google.com/group/excel-macros/subscribe -~----------~----~----~----~------~----~------~--~---