Results 1 to 6 of 6

Unmatched coparing two Columns Tab1 with two Columns Tab2

Threaded View

  1. #1
    Valued Forum Contributor marreco's Avatar
    Join Date
    07-02-2011
    Location
    Brazil
    MS-Off Ver
    Excel 2010
    Posts
    1,862

    Unmatched coparing two Columns Tab1 with two Columns Tab2

    Hi.
    The code below was developed by tigeravatar, i try adapt to use only two sheets, but i need compare two columns (concatenated) of "Orig" tab with two columns (concatenated) tab "Result"

    costume 2712 is different costume 27diff then copy this line to Result tab.

    Option Explicit
    Sub GetUnmatched()
    'Created by: tigeravatar
    'http://www.excelforum.com/excel-programming-vba-macros/774778-excel-vba-find-unmatched.html
    'http://www.excelforum.com/excel-programming-vba-macros/1026172-excel-vba-find-unmatched-id-number-and-copy-the-whole-row.html
    
        Dim ResultSheet As String:          ResultSheet = "Result"   'Here I adapted only between two tabs
        Dim FirstSheet As String:           FirstSheet = "Result"
        Dim SecondSheet As String:          SecondSheet = "Orig"
        Dim FirstSheetDataCol As String:    FirstSheetDataCol = "E"  'How use column E and J here?
        Dim SecondSheetDataCol As String:   SecondSheetDataCol = "E" 'How use column E and J here?
        
        Dim rngData1 As Range:  Set rngData1 = Sheets(FirstSheet).Range(FirstSheetDataCol & "2:" & Sheets(FirstSheet).Cells(Rows.Count, FirstSheetDataCol).End(xlUp).Address)
        Dim rngData2 As Range:  Set rngData2 = Sheets(SecondSheet).Range(SecondSheetDataCol & "2:" & Sheets(SecondSheet).Cells(Rows.Count, SecondSheetDataCol).End(xlUp).Address)
        
        Dim aCell As Range
        For Each aCell In rngData2
            If rngData1.Find(aCell.Value) Is Nothing Then
                Sheets(ResultSheet).Range("A" & Rows.Count).End(xlUp).Offset(1, 0).EntireRow.Value = aCell.EntireRow.Value
            End If
        Next aCell
        
    End Sub
    Attached Files Attached Files
    "No xadrez nem sempre a menor dist?ncia entre dois pontos ? uma linha reta" G. Kasparov.

    If your problem is solved, please say so clearly, and mark your thread as Solved: Click the Edit button on your first post in the thread, Click Go Advanced, select b from the Prefix dropdown, then click Save Changes. If more than two days have elapsed, the Edit button will not appear -- ask a moderator to mark it.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Help!!! how can i copy contents from Tab2 into Tab1 using a same cell comparison
    By merQrey in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-30-2014, 06:22 AM
  2. [SOLVED] Insert rows last row Tab1 - Tab2 last line
    By marreco in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-24-2014, 03:41 PM
  3. [SOLVED] Printing tab1 + tab2 as same print job via VBA
    By bigmantitus in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-01-2013, 07:47 AM
  4. Replies: 6
    Last Post: 10-04-2011, 08:48 AM
  5. Replies: 9
    Last Post: 06-09-2011, 10:24 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1