+ Reply to Thread
Results 1 to 2 of 2

Compare to columns on two different spread sheet, only pick up the

  1. #1
    Ming
    Guest

    Compare to columns on two different spread sheet, only pick up the

    I have created the macro to check the changes compare to the values in sheet1
    vs sheet2, if anything changed more than certain amount, it will be copied
    and pasted to another sheet. The thing is I couldn't figure out how to find
    out the names only on sheet1 or only on sheet2. for example, if i check
    column A on each sheet, how can i find out the names only on sheet1 and only
    on sheet2, then i can copy, paste the value to another spread sheet?

    Thanks a lot.

    Ming

  2. #2
    Ming
    Guest

    RE: Compare to columns on two different spread sheet, only pick up the

    Finally, I found out answer from Ron's website. Thanks a lot Ron. His website
    is http://www.rondebruin.nl

    Here's the code, I'm using and hope it could do some help to other people as
    well.

    Dim AA As String
    Dim BB As Long
    Dim CC As String
    Dim DD As String
    Dim DateDD As Date
    Dim EE As Double
    Dim AAy As String
    Dim BBy As Long
    Dim CCy As String
    Dim DDy As String
    Dim DateDDy As Date
    Dim EEy As Double
    Dim change As Double
    Dim val As Range
    Dim vStr As String
    Dim valFound As Range
    Dim valOut As Range
    Dim fistadd As String
    Dim FindString As String
    Dim rng As Range
    Dim FindStringy As String
    Dim rngy As Range
    Dim t as Integer
    Dim t1 as Integer
    Dim b as Integer

    Sheets("DATA-A").Select
    For t = Cells(Rows.Count, "a").End(xlUp).Row To 2 Step -1
    Sheets("DATA-A").Select
    Cells(t, "A").Select
    AA = Cells(t, "A").Value
    BB = Cells(t, "B").Value
    CC = Cells(t, "C").Value
    DD = Cells(t, "D").Value
    DateDD = Cells(t, "E").Value
    EE = Cells(t, "F").Value
    FindString = Cells(t, "A").Value
    Sheets("DATA-B").Select
    With Sheets("DATA-B").Columns("A:A")
    Set rng = .Find(What:=FindString, _
    After:=.Cells(.Cells.Count), _
    LookIn:=xlValues, _
    LookAt:=xlWhole, _
    SearchOrder:=xlByRows, _
    SearchDirection:=xlNext, _
    MatchCase:=False)
    If Not rng Is Nothing Then
    Application.Goto rng, True
    Else
    Sheets("Changes").Select
    b = Cells(Rows.Count, "a").End(xlUp).Row + 1
    Cells(b, "A").Value = AA
    Cells(b, "B").Value = BB
    Cells(b, "C").Value = CC
    Cells(b, "D").Value = DD
    Cells(b, "E").Value = DateDD
    Cells(b, "F").Value = EE
    Cells(b, "G").Value = "New Addition,
    please check."
    End If
    End With


    Next t
    Sheets("DATA-B").Select
    For t1 = Cells(Rows.Count, "a").End(xlUp).Row To 2 Step -1
    Sheets("DATA-B").Select
    Cells(t1, "A").Select
    AAy = Cells(t1, "A").Value
    BBy = Cells(t1, "B").Value
    CCy = Cells(t1, "C").Value
    DDy = Cells(t1, "D").Value
    DateDDy = Cells(t1, "E").Value
    EEy = Cells(t1, "F").Value
    FindStringy = Cells(t1, "A").Value
    Sheets("DATA-A").Select
    With Sheets("DATA-A").Columns("A:A")
    Set rngy = .Find(What:=FindStringy, _
    After:=.Cells(.Cells.Count), _
    LookIn:=xlValues, _
    LookAt:=xlWhole, _
    SearchOrder:=xlByRows, _
    SearchDirection:=xlNext, _
    MatchCase:=False)
    If Not rngy Is Nothing Then
    Application.Goto rngy, True
    Else
    Sheets("Changes").Select
    b = Cells(Rows.Count, "a").End(xlUp).Row + 1
    Cells(b, "A").Value = AAy
    Cells(b, "B").Value = BBy
    Cells(b, "C").Value = CCy
    Cells(b, "D").Value = DDy
    Cells(b, "E").Value = DateDDy
    Cells(b, "F").Value = EEy
    Cells(b, "G").Value = "Not shown on
    today's list, Please Check"
    End If
    End With


    Next t1


    "Ming" wrote:

    > I have created the macro to check the changes compare to the values in sheet1
    > vs sheet2, if anything changed more than certain amount, it will be copied
    > and pasted to another sheet. The thing is I couldn't figure out how to find
    > out the names only on sheet1 or only on sheet2. for example, if i check
    > column A on each sheet, how can i find out the names only on sheet1 and only
    > on sheet2, then i can copy, paste the value to another spread sheet?
    >
    > Thanks a lot.
    >
    > Ming


+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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