Help with macro to highlight similar cells from different worksheets

sgauntlett23

New Member
Joined
Sep 28, 2011
Messages
1
Good morning,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
<o:p></o:p>
I’m no macro expert and I could really do with some help editing this macro to do what i need it to do.<o:p></o:p>
<o:p></o:p>
Currently it compares 1 column in one sheet, with one from another. If a matching item is found, it highlights that item on one of the sheets.<o:p></o:p>
<o:p></o:p>
Problem i have is that the data in the two columns being compared does not always match exactly. For example: if "Blackberry desktop manager" is found in one column, and "RIM Blackberry Desktop manager" is in the other, it will not highlight it as they are not exactly the same.<o:p></o:p>
<o:p></o:p>
Ideally what I need is it to check for a partial match, say a word or two. <o:p></o:p>
<o:p></o:p>
Is there any way that this can be done?? Thanks in advance.<o:p></o:p>

Code:
Public Sub CommandButton1_Click()
Dim i As Integer, j As Integer
i = 2
j = 6
Worksheets("Packaged_SCCM").Columns("E").Interior.Color = xlNone
Worksheets("Dept_Software").Columns("E").Interior.Color = xlNone
While Not IsEmpty(Worksheets("Packaged_SCCM").Cells(i, 1))
    j = 6
    While Not IsEmpty(Worksheets("Dept_Software").Cells(j, 5))
        If Worksheets("Packaged_SCCM").Cells(i, 5) = Worksheets("Dept_Software").Cells(j, 5) Then
            Worksheets("Dept_Software").Cells(j, 5).Interior.Color = vbGreen
            Worksheets("Dept_Software").Select
            Cells(j, 5).Select
 
        End If
        j = j + 1
    Wend
    i = i + 1
Wend
i = 2
While Not IsEmpty(Worksheets("Dept_Software").Cells(i, 1))
    j = 2
    While Not IsEmpty(Worksheets("Packaged_SCCM").Cells(j, 7))
        If Worksheets("Dept_Software").Cells(i, 1) <> Worksheets("Packaged_SCCM").Cells(j, 7) And Worksheets("Dept_Software").Cells(i, 1).Interior.Color <> vbRed Then
            Worksheets("Dept_Software").Cells(i, 1).Interior.Color = vbYellow
        End If
        j = j + 1
    Wend
    i = i + 1
Wend
End Sub
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"

Forum statistics

Threads
1,224,521
Messages
6,179,278
Members
452,902
Latest member
Knuddeluff

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