Hi,
I have the code below but not working want to find difference between JAN/JUL tabs both column A but not working I kow there's a difference because one has 316 rows and the other one 315 then there's one line missing in JUL tab has only 315.
here is the code:
thanks,
I have the code below but not working want to find difference between JAN/JUL tabs both column A but not working I kow there's a difference because one has 316 rows and the other one 315 then there's one line missing in JUL tab has only 315.
here is the code:
Code:
Sub compare() Dim myRng As Range
Dim lastCell As Long
Dim mydiffs As Integer
'Get the last row
Dim lastRow As Integer
lastRow = ActiveSheet.UsedRange.Rows.Count
'Debug.Print "Last Row is " & lastRow
Dim c As Range
Dim d As Range
Application.ScreenUpdating = False
For Each c In Worksheets("JAN").Range("A3:A" & lastRow).Cells
For Each d In Worksheets("JUL").Range("A3:A" & lastRow).Cells
c.Interior.Color = vbRed
If (InStr(1, d, c, 1) > 0) Then
c.Interior.Color = vbWhite
Exit For
End If
Next
Next
For Each c In Worksheets("JUL").Range("A3:A" & lastRow).Cells
For Each d In Worksheets("JAN").Range("A3:A" & lastRow).Cells
c.Interior.Color = vbRed
If (InStr(1, d, c, 1) > 0) Then
c.Interior.Color = vbWhite
Exit For
End If
Next
Next
'Display a message box to demonstrate the differences
MsgBox mydiffs & " differences found", vbInformation
Application.ScreenUpdating = True
End Sub
thanks,