Hai try this
Dim datawk As Workbook Dim last_row, this_last_row As Integer Dim hold() As Variant Set datawk = Workbooks.Open("C:\Documents and Settings\User\My Documents\sample.xls") last_row = Workbooks("sample").Sheets(1).Cells(Rows.Count, 3).End(xlUp).Row Workbooks("sample").Sheets(1).Activate ReDim hold(1 To last_row - 1) As Variant For i = 1 To last_row - 1 hold(i) = Cells(i + 1, 3).Value Next i this_last_row = ThisWorkbook.Sheets(1).Cells(Rows.Count, 3).End(xlUp).Row - 1 ThisWorkbook.Sheets(1).Activate For ii = 1 To this_last_row chk = Cells(ii + 1, 3).Value For chk_val = 1 To last_row - 1 If chk = hold(chk_val) Then Cells(ii + 1, 3).Interior.Color = vbRed End If Next chk_val Next ii Workbooks("sample").Close





Reply With Quote