The following code provides the srot of thing i am looking for However, this is comparing cell by cell, and where certain items are removed/added on the newer list it knocks everything out.
Sub RunCompare()
Call compareSheets("A", "B")
End Sub
Sub compareSheets(shtBefore As String, shtAfter As String)
Dim mycell As Range
Dim mydiffs As Integer
For Each mycell In ActiveWorkbook.Worksheets(shtAfter).UsedRange
If Not mycell.Value = ActiveWorkbook.Worksheets(shtBefore).Cells(mycell.Row, mycell.Column).Value Then
mycell.Interior.Color = vbYellow
mydiffs = mydiffs + 1
End If
Next
MsgBox mydiffs & " differences found", vbInformation
ActiveWorkbook.Sheets(shtAfter).Select
End Sub
So, Is it possible to alter this slighty and make it look for the same circuit reference and then compare?
Item circuit Ref Description </SPAN>
1 C1 Description Description Description Description Description </SPAN></SPAN>
2 C2 Description Description Description Description Description </SPAN></SPAN>
3 C3 Description Description Description Description Description</SPAN></SPAN>
If we look for C1 on both sheets and then compare in a similar way to the above code?
Even better would be to notify if there are any additional Refs, and refs that no longer exist between the two sheets.
Any help would be much appreciated!
</SPAN>
Sub RunCompare()
Call compareSheets("A", "B")
End Sub
Sub compareSheets(shtBefore As String, shtAfter As String)
Dim mycell As Range
Dim mydiffs As Integer
For Each mycell In ActiveWorkbook.Worksheets(shtAfter).UsedRange
If Not mycell.Value = ActiveWorkbook.Worksheets(shtBefore).Cells(mycell.Row, mycell.Column).Value Then
mycell.Interior.Color = vbYellow
mydiffs = mydiffs + 1
End If
Next
MsgBox mydiffs & " differences found", vbInformation
ActiveWorkbook.Sheets(shtAfter).Select
End Sub
So, Is it possible to alter this slighty and make it look for the same circuit reference and then compare?
Item circuit Ref Description </SPAN>
1 C1 Description Description Description Description Description </SPAN></SPAN>
2 C2 Description Description Description Description Description </SPAN></SPAN>
3 C3 Description Description Description Description Description</SPAN></SPAN>
If we look for C1 on both sheets and then compare in a similar way to the above code?
Even better would be to notify if there are any additional Refs, and refs that no longer exist between the two sheets.
Any help would be much appreciated!
</SPAN>