Consulting

Results 1 to 5 of 5

Thread: Simple Comparison

  1. #1

    Simple Comparison

    I have a list of email addresses in column A and B. All the email addresses in column B (the shorter list) is included in column A. How can I print in column C, the email addresses included in column A and NOT in column B.

    THANKS!!

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,286
    Location
    [vba]

    Public Sub ProcessData()
    Const TEST_COLUMN As String = "A" '<=== change to suit
    Dim i As Long
    Dim LastRow As Long
    Dim NextRow As Long

    With ActiveSheet

    LastRow = .Cells(.Rows.Count, TEST_COLUMN).End(xlUp).Row
    For i = 1 To LastRow

    If IsError(Application.Match(.Cells(i, TEST_COLUMN).Value, .Columns(2), 0)) Then

    NextRow = NextRow + 1
    .Cells(i, TEST_COLUMN).Copy Worksheets("Sheet2").Cells(NextRow, "A")
    End If
    Next i

    End With

    End Sub
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    Thanks, but the results are not printing on column C.

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,286
    Location
    Missed that bit

    [vba]

    Public Sub ProcessData()
    Const TEST_COLUMN As String = "A" '<=== change to suit
    Dim i As Long
    Dim LastRow As Long
    Dim NextRow As Long

    With ActiveSheet

    LastRow = .Cells(.Rows.Count, TEST_COLUMN).End(xlUp).Row
    For i = 1 To LastRow

    If IsError(Application.Match(.Cells(i, TEST_COLUMN).Value, .Columns(2), 0)) Then

    NextRow = NextRow + 1
    .Cells(i, TEST_COLUMN).Copy .Cells(NextRow, "C")
    End If
    Next i

    End With

    End Sub
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  5. #5
    Thanks a bunch. You are very talented

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •