Match Values and Highlite row

K

K

Hi all, I have list of 6 digit numbers in Column A of Sheet2 like see
below

A …….col
665544
564788
658977
457896
335566
789456
etc……..

I want macro which should match Sheet1 Range("B2:B100") values in
Sheet2 Column A values (as shown above) and if value match then do
nothing but the value which don’t match then macro should higlight
that value cell row in Sheet1 from row B to F. Please can any friend
can help
 
B

Bob Phillips

Public Sub Hilite()
Dim LastRow As Long
Dim i As Long

With Worksheets("Sheet1")

LastRow = .Cells(.Rows.Count, "B").End(xlUp).Row
For i = 1 To LastRow

If IsError(Application.Match(.Cells(i, "B").Value,
Worksheets("Sheet2").Columns(1),0) Then

.Cells(i, "B").Resize(,5).Interior.Colorindex = 38
End If
Next i
End Sub

--
__________________________________
HTH

Bob

Hi all, I have list of 6 digit numbers in Column A of Sheet2 like see
below

A …….col
665544
564788
658977
457896
335566
789456
etc……..

I want macro which should match Sheet1 Range("B2:B100") values in
Sheet2 Column A values (as shown above) and if value match then do
nothing but the value which don’t match then macro should higlight
that value cell row in Sheet1 from row B to F. Please can any friend
can help
 
K

K

Public Sub Hilite()
Dim LastRow As Long
Dim i As Long

    With Worksheets("Sheet1")

        LastRow = .Cells(.Rows.Count, "B").End(xlUp).Row
        For i = 1 To LastRow

            If IsError(Application.Match(.Cells(i, "B").Value,
Worksheets("Sheet2").Columns(1),0) Then

                .Cells(i, "B").Resize(,5).Interior.Colorindex = 38
            End If
        Next i
End Sub

--
__________________________________
HTH

Bob


Hi all, I have list of 6 digit numbers in Column A of Sheet2 like see
below

 A …….col
665544
564788
658977
457896
335566
789456
etc……..

I want macro which should match Sheet1 Range("B2:B100") values in
Sheet2 Column A values (as shown above) and if value match then do
nothing but the value which don’t match then macro should higlight
that value cell row in Sheet1 from row B to F. Please can any friend
can help

Thanks Bob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top