paulk29
Technical User
- Jul 15, 2003
- 113
Hi,
I have two lists of IP addresses, I want to compare list A to list B and output what does not match from list B into another Column. Does anyone know how to do this?
I have a macro that will output the matches in both Lists below;
Thanks
Paul
Sub Find_Matches()
Dim CompareRange As Variant, x As Variant, y As Variant
' Set CompareRange equal to the range to which you will
' compare the selection.
Set CompareRange = Range("C1:C5")
' NOTE: If the compare range is located on another workbook
' or worksheet, use the following syntax.
' Set CompareRange = Workbooks("Book2"). _
' Worksheets("Sheet2").Range("C1:C5")
'
' Loop through each cell in the selection and compare it to
' each cell in CompareRange.
For Each x In Selection
For Each y In CompareRange
If x = y Then x.Offset(0, 1) = x
Next y
Next x
End Sub
Paul Kilcoyne B eng. CCNA
I have two lists of IP addresses, I want to compare list A to list B and output what does not match from list B into another Column. Does anyone know how to do this?
I have a macro that will output the matches in both Lists below;
Thanks
Paul
Sub Find_Matches()
Dim CompareRange As Variant, x As Variant, y As Variant
' Set CompareRange equal to the range to which you will
' compare the selection.
Set CompareRange = Range("C1:C5")
' NOTE: If the compare range is located on another workbook
' or worksheet, use the following syntax.
' Set CompareRange = Workbooks("Book2"). _
' Worksheets("Sheet2").Range("C1:C5")
'
' Loop through each cell in the selection and compare it to
' each cell in CompareRange.
For Each x In Selection
For Each y In CompareRange
If x = y Then x.Offset(0, 1) = x
Next y
Next x
End Sub
Paul Kilcoyne B eng. CCNA