+ Reply to Thread
Results 1 to 2 of 2

Help! Search for data on one workbook and paste on another workbook.

Hybrid View

  1. #1
    Registered User
    Join Date
    01-21-2015
    Location
    Singapore, Singapore
    MS-Off Ver
    2010, 2007
    Posts
    13

    Help! Search for data on one workbook and paste on another workbook.

    Hello,

    I was wondering how can I search with a push of a button for a certain name from a workbook and paste the rest of the data that comes along with name to another workbook.


    Looking for the data of the people mentioned:


    (Workbook A)
    Name Birthday Gender
    Dylon
    Angel
    Cassy
    Benjamin



    Raw data workbook, this is the workbook that the data would be extracted from:


    (Workbook B)
    Name Birthday Age Gender Weight
    Angel 10 Jan 1988 27 Female 60
    Benjamin 20 February 1988 27 Male 56
    Cassy 30 November 1995 20 Female 49
    Dylon 15 December 1992 23 Male 55




    Results that i expect:


    (Workbook A)
    Name Birthday Gender
    Dylon 15 December 1992 Male
    Angel 10 Jan 1988 Female
    Cassy 30 November 1995 Female
    Benjamin 20 February 1988 Male


    If possible, any kind souls able to help me out with this creating the workbooks for me? Very much appreciated and thanks in advance everybody!

  2. #2
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Help! Search for data on one workbook and paste on another workbook.

    Maybe:

    Sub elizevonne()
    Dim x As Long, y As Range, wbkA As Workbook, wbkB As Workbook
    Set wbkA = Workbooks("Workbook A.xls")
    Set wbkB = Workbooks("Workbook B.xls")
    With wbkA.Sheets("Sheet1")
    For i = 2 To .Range("A" & Rows.Count).End(3).row
        Set y = wbkB.Sheets("Sheet1").Columns(1).Find(.Cells(i, "A").Value, LookIn:=xlValues, lookat:=xlWhole)
            If Not y Is Nothing Then
                .Cells(i, "B") = wbkB.Sheets("Sheet1").Cells(y.row, "B")
                .Cells(i, "C") = wbkB.Sheets("Sheet1").Cells(y.row, "D")
            End If
        Set y = Nothing
    Next i
    .Columns(2).NumberFormat = "[$-409]d-mmm-yy;@"
    End With
    End Sub

+ 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. Can I have Excel search another workbook for data and import it to my current workbook?
    By mgruber in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 0
    Last Post: 09-05-2014, 07:13 PM
  2. [SOLVED] Macro to find data in source workbook and copy paste to target workbook
    By D.Lovell in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 04-23-2014, 06:21 AM
  3. [SOLVED] Code to copy data from a closed workbook and paste in active workbook using named range.
    By paullie1912 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 02-28-2014, 02:38 AM
  4. Search for a value in closed workbook and paste adjacent cells to open workbook
    By jmapark91 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-22-2013, 10:54 AM
  5. Replies: 6
    Last Post: 01-29-2013, 07:01 AM
  6. insert data from child workbook to master workbook by search matching records
    By jjgal767 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-21-2011, 05:10 AM
  7. Replies: 0
    Last Post: 12-10-2009, 04:18 AM

Tags for this Thread

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