I am trying to modify my macro
1) to have order not matter in the columns
2) show what is missing from either column
3) sort the results in lowest to highest
example
column 1 column 2
5 3
1 1
7 5
2 7
Sub Compare()
'
' Compare Macro
'
Dim i As Long, _
LRa As Long, _
LRb As Long, _
rowx As Long
LRa = Range("A" & Rows.Count).End(xlUp).Row
LRb = Range("B" & Rows.Count).End(xlUp).Row
rowx = 2
Application.ScreenUpdating = False
For i = 2 To LRa
If IsError(Application.Match(Range("A" & i).Value, Range("B2:B" & LRb), 0)) Then
Range("C" & rowx).Value = Range("A" & i).Value
rowx = rowx + 1
End If
Next i
For i = 2 To LRb
If IsError(Application.Match(Range("B" & i).Value, Range("A2:A" & LRa), 0)) Then
Range("C" & rowx).Value = Range("B" & i).Value
rowx = rowx + 1
End If
Next i
End Sub
1) to have order not matter in the columns
2) show what is missing from either column
3) sort the results in lowest to highest
example
column 1 column 2
5 3
1 1
7 5
2 7
Sub Compare()
'
' Compare Macro
'
Dim i As Long, _
LRa As Long, _
LRb As Long, _
rowx As Long
LRa = Range("A" & Rows.Count).End(xlUp).Row
LRb = Range("B" & Rows.Count).End(xlUp).Row
rowx = 2
Application.ScreenUpdating = False
For i = 2 To LRa
If IsError(Application.Match(Range("A" & i).Value, Range("B2:B" & LRb), 0)) Then
Range("C" & rowx).Value = Range("A" & i).Value
rowx = rowx + 1
End If
Next i
For i = 2 To LRb
If IsError(Application.Match(Range("B" & i).Value, Range("A2:A" & LRa), 0)) Then
Range("C" & rowx).Value = Range("B" & i).Value
rowx = rowx + 1
End If
Next i
End Sub