sgauntlett23
New Member
- Joined
- Sep 28, 2011
- Messages
- 1
Good morning,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-comfficeffice" /><o></o>
<o></o>
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></o>
<o></o>
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></o>
<o></o>
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></o>
<o></o>
Ideally what I need is it to check for a partial match, say a word or two. <o></o>
<o></o>
Is there any way that this can be done?? Thanks in advance.<o></o>
<o></o>
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></o>
<o></o>
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></o>
<o></o>
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></o>
<o></o>
Ideally what I need is it to check for a partial match, say a word or two. <o></o>
<o></o>
Is there any way that this can be done?? Thanks in advance.<o></o>
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