Looking for help comparing material lists!

Elbusta

New Member
Joined
Sep 8, 2014
Messages
1
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>
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.

Forum statistics

Threads
1,222,561
Messages
6,166,802
Members
452,073
Latest member
akinch

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top