Okay so I managed to work out this code somehow with help from many of the coding experts here. I need to create a macro that compares data in two worksheets.
In both of
Your "eRequest ID" are located in both sheets in column A so I compare this column. If there is a match in both sheets the loop exists. If there is no match then the row get copied to "mismatch". loop for both sheets.
Sub compareAndCopy()
Dim lastRowMaster As Integer
Dim lastRowDev As Integer
Dim lastRowMis As Integer
Dim foundTrue As Boolean
Application.ScreenUpdating = False
lastRowMaster = Sheets("JULY15Release_Master Inventory").Cells(Sheets("JULY15Release_Master Inventory").Rows.Count, "A").End(xlUp).Row
lastRowDev = Sheets("JULY15Release_Dev status").Cells(Sheets("JULY15Release_Dev status").Rows.Count, "A").End(xlUp).Row
lastRowMis = Sheets("Mismatch").Cells(Sheets("Mismatch").Rows.Count, "A").End(xlUp).Row
'start loop Master
For i = 2 To lastRowMaster '1 = headers
foundTrue = False
For j = 2 To lastRowDev
If Sheets("JULY15Release_Master Inventory").Cells(i, 1).Value = Sheets("JULY15Release_Dev status").Cells(j, 1).Value Then
foundTrue = True
Exit For
End If
Next j
If foundTrue = False Then
Sheets("JULY15Release_Master Inventory").Rows(i).Copy Destination:= _
Sheets("Mismatch").Rows(lastRowMis + 1)
lastRowMis = lastRowMis + 1
End If
Next i
'end loop master
Sheets("Mismatch").Cells(lastRowMis + 2, 1).Value = "results from Dev"
lastRowMis = lastRowMis + 2
'start loop Dev
For i = 2 To lastRowDev '1 = headers
foundTrue = False
For j = 2 To lastRowMaster
If Sheets("JULY15Release_Dev status").Cells(i, 1).Value = Sheets("JULY15Release_Master Inventory").Cells(i, 1).Value Then
foundTrue = True
Exit For
End If
Next j
If foundTrue = False Then
Sheets("JULY15Release_Dev status").Rows(i).Copy Destination:= _
Sheets("Mismatch").Rows(lastRowMis + 1)
lastRowMis = lastRowMis + 1
End If
Next i
'end loop dev
Application.ScreenUpdating = False
End Sub