+ Reply to Thread
Results 1 to 7 of 7

Compare Ref in Col B on Sheet1 to sheet 2 and where the no match copy data to sheet2

  1. #1
    Forum Contributor
    Join Date
    07-12-2018
    Location
    South Africa
    MS-Off Ver
    Office 2021
    Posts
    2,742

    Compare Ref in Col B on Sheet1 to sheet 2 and where the no match copy data to sheet2

    I have data on sheet "Data Import"


    I want to compare the refrence in Col B from row 2 onwards to that in Sheet "Prev Data" and where there in no match I want the data from sheet "Import Data" copied as follows to Sheet "Prev Data"

    1) Col A:D sheet "Imported Data" to be copied to Cols A:D on Sheet "Prev data"

    2) Col E on Sheet "Imported data" to be copied to Col F on sheet "prev Data"


    I have attached sample data

    Your assistance is most appreciated
    Attached Files Attached Files

  2. #2
    Forum Expert dangelor's Avatar
    Join Date
    09-06-2011
    Location
    Indiana, USA
    MS-Off Ver
    365 Pro Plus
    Posts
    2,274

    Re: Compare Ref in Col B on Sheet1 to sheet 2 and where the no match copy data to sheet2

    Possibly...
    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    07-12-2018
    Location
    South Africa
    MS-Off Ver
    Office 2021
    Posts
    2,742

    Re: Compare Ref in Col B on Sheet1 to sheet 2 and where the no match copy data to sheet2

    Thanks Dangelor. Have tested your code and it works perfectly

  4. #4
    Forum Expert dangelor's Avatar
    Join Date
    09-06-2011
    Location
    Indiana, USA
    MS-Off Ver
    365 Pro Plus
    Posts
    2,274

    Re: Compare Ref in Col B on Sheet1 to sheet 2 and where the no match copy data to sheet2

    Glad to help!

  5. #5
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Cool Hi ! Another way …


    With a single loop a starter demonstration :

    PHP Code: 
    Sub Demo1()
      Const 
    "TRANSPOSE(IF(ISNA(MATCH(#,¤,0)),ROW(#)))""Prev Data"
        
    Dim R&, A$, V
            R 
    Sheets(S).Cells(Rows.Count2).End(xlUp).Row
            A 
    Sheets(S).Range("B1:B" R).Address(External:=True)
            
    Application.ScreenUpdating False
        With Range
    ("'Imported Data'!A1").CurrentRegion
            
    For Each V In Filter(.Parent.Evaluate(ReplaceReplace(F"#", .Columns(2).Address), "¤"A)), FalseFalse)
                
    1
               
    .Rows(V).Columns("A:D").Copy Sheets(S).Cells(R1)
               .
    Cells(V5).Copy Sheets(S).Cells(R6)
            
    Next
        End With
            Application
    .ScreenUpdating True
    End Sub 
    Do you like it ? So thanks to click on bottom left star icon « Add Reputation » !

  6. #6
    Forum Contributor
    Join Date
    07-12-2018
    Location
    South Africa
    MS-Off Ver
    Office 2021
    Posts
    2,742

    Re: Compare Ref in Col B on Sheet1 to sheet 2 and where the no match copy data to sheet2

    Thanks Marc. Code works perfectly

  7. #7
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow

    Thanks for the rep' !

    Can be achieved too without any loop just using an Excel basics : an advanced filter …

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Copy Data from Cells A Sheet1 to Sheet2 E1 and then Sheet 3 B3
    By Dess in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-11-2015, 03:25 AM
  2. [SOLVED] Match value in sheet1 for sheet2 and copy to sheet2
    By soli004 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-04-2014, 07:15 PM
  3. Compare and copy new rows from Sheet2 to Sheet1 if conditions are met
    By author1 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-25-2014, 02:07 PM
  4. Replies: 6
    Last Post: 07-25-2013, 02:58 PM
  5. [SOLVED] Copy and Paste Entire Row from Sheet1->Sheet2 based on text string match in Sheet1 Row
    By dmlovic in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-17-2012, 08:42 AM
  6. [SOLVED] Compare 2 cells in 2 sheets, if both match append data in Sheet2 to Sheet1
    By furious0331 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-29-2012, 01:05 AM
  7. How Copy the Data from more cell in sheet1 to a row on sheet2 (others sheet)
    By antoni in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 06-11-2009, 09:23 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