Hi Everyone,
I've been working on a VBA script but I'm struggling with the last section of the code. Let me start by being honest and saying that I'm not really good in VBA coding myself... I can manage and know what to in several situations and depend on open source code as well. For the last section of my script I have the following steps that I'd like it to do;
I have 2 list in 2 different Excel workbooks. One file is containing a list of e-mail addresses these e-mail addresses have to be used as a search in another Workbook and when found I have to add data in column M.
I did find a piece of code online that compares 2 results against each other but I've been having difficulty reading the code and editing it to my needs. The code does compare 2 lists.
If there is another way to approach what I need, that is fine by me. This code did seem to do for the most part what I'd like it to do.
I've been working on a VBA script but I'm struggling with the last section of the code. Let me start by being honest and saying that I'm not really good in VBA coding myself... I can manage and know what to in several situations and depend on open source code as well. For the last section of my script I have the following steps that I'd like it to do;
I have 2 list in 2 different Excel workbooks. One file is containing a list of e-mail addresses these e-mail addresses have to be used as a search in another Workbook and when found I have to add data in column M.
I did find a piece of code online that compares 2 results against each other but I've been having difficulty reading the code and editing it to my needs. The code does compare 2 lists.
VBA Code:
Sub FindDifferences()
Dim i As Long, ii As Long, sq1 As Variant, sq2 As Variant, m As Long
sq1 = Sheet1.Cells(1).CurrentRegion.Columns(1)
sq2 = Sheet2.Cells(1).CurrentRegion.Columns(1)
Sheet3.Columns(1).ClearContents
For i = 1 To UBound(sq1)
ii = 0
On Error Resume Next
ii = Application.Match(sq1(i, 1), sq2, 0)
On Error GoTo 0
If ii = 0 Then
m = m + 1
Sheet3.Cells(m, 1).Value = sq1(i, 1)
End If
Next
For i = 1 To UBound(sq2)
ii = 0
On Error Resume Next
ii = Application.Match(sq2(i, 1), sq1, 0)
On Error GoTo 0
If ii = 0 Then
m = m + 1
Sheet3.Cells(m, 1).Value = sq2(i, 1)
End If
Next
End Sub
If there is another way to approach what I need, that is fine by me. This code did seem to do for the most part what I'd like it to do.