HUYNHTIEN0202
Thành viên chính thức


- Tham gia
- 22/8/14
- Bài viết
- 92
- Được thích
- 1
Nội dung file như sau
Cột G & H so sánh với cột AE & AF nếu khac nhau thi tô màu cột H
code đang dùng
Cột G & H so sánh với cột AE & AF nếu khac nhau thi tô màu cột H
code đang dùng
Mã:
Dim Arr(1 To 2000, 1 To 3) As Variant
Dim dArr(1 To 2000, 1 To 3) As Variant
Dim I As Integer, J As Integer, K As Integer
Dim checkrow As Integer, Rw As Long
With Sheet6
.Range([B6], .[B6].End(xlDown)).Resize(, 23).Interior.ColorIndex = 0
'------------------------------------------------------------------------
'Arr = .Range([G6], .[G6].End(xlDown)).Resize(, 3)
'dArr = .Range([AE6], .[AE6].End(xlDown)).Resize(, 3)
Do
Rw = Rw + 1
Arr(Rw, 1) = .Cells(Rw + 6, 7)
Arr(Rw, 2) = .Cells(Rw + 6, 8)
Loop Until .Cells(Rw + 6, 7) = ""
'-------------------------------------------------------------------------
For I = 1 To 2000
checkrow = checkrow + 1
dArr(checkrow, 1) = .Cells(I + 6, 31)
dArr(checkrow, 2) = .Cells(I + 6, 32)
Next
'-----------------------------------------------------------------------------
For I = 1 To checkrow
For J = 1 To Rw
If Arr(J, 1) = dArr(I, 1) Then
If Arr(J, 2) <> dArr(I, 2) Then
For K = 1 To 2000
If .Cells(K, 7) = Arr(J, 1) Then
.Cells(K, 8).Interior.ColorIndex = 6
End If
Next K
End If
Exit For
End If
Next J
Next I
End With
MsgBox ("FINISH")