+ Reply to Thread
Results 1 to 6 of 6

Pulling Data From Other Workbook Based On Matching Cells

  1. #1
    Registered User
    Join Date
    05-04-2011
    Location
    California, US
    MS-Off Ver
    Excel 2011 (Mac)
    Posts
    4

    Pulling Data From Other Workbook Based On Matching Cells

    Hello everyone!

    I am working on a macro that would look at the value in a cell (let's call it a Student ID) and match that value to a workbook where all the students are stored and then populate the student's name one cell over in the original work book where the Student ID was. It would do this till it read the last Student ID number in a certain column.

    I'm fairly new to VBA for Excel so this has had me stuck for a few weeks. I've looked at several tutorials and I've gotten snippets of code that would let me extract cell values from other workbooks but it's not really based on anything. I know a loop of some sort would be needed and a defined function that would probably go in the loop. Any suggestions or even code would be really helpful! I thank you in advance!

    Regards,
    Efrain P.

  2. #2
    Valued Forum Contributor
    Join Date
    09-21-2003
    Location
    British Columbia , Canada
    MS-Off Ver
    03,07,10,13
    Posts
    727

    Re: Pulling Data From Other Workbook Based On Matching Cells

    Without knowing names of source and target; paths, directories, filenames, sheet names , columns involved etc ... this is the best i can do.

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    05-04-2011
    Location
    California, US
    MS-Off Ver
    Excel 2011 (Mac)
    Posts
    4

    Re: Pulling Data From Other Workbook Based On Matching Cells

    Wow! I'm going to go over that to see if I can understand it! Thank you very much!

  4. #4
    Valued Forum Contributor
    Join Date
    09-21-2003
    Location
    British Columbia , Canada
    MS-Off Ver
    03,07,10,13
    Posts
    727

    Re: Pulling Data From Other Workbook Based On Matching Cells

    Const ClosedRefReturnColumn As String = "2" SHOULD BE Const ClosedRefReturnColumn As Integer = 2

  5. #5
    Registered User
    Join Date
    05-04-2011
    Location
    California, US
    MS-Off Ver
    Excel 2011 (Mac)
    Posts
    4

    Re: Pulling Data From Other Workbook Based On Matching Cells

    Ignore this post
    Last edited by FRin323; 05-13-2011 at 08:54 AM. Reason: Error

  6. #6
    Registered User
    Join Date
    05-04-2011
    Location
    California, US
    MS-Off Ver
    Excel 2011 (Mac)
    Posts
    4

    Re: Pulling Data From Other Workbook Based On Matching Cells

    Ignore the previous post with the code. I've been looking at the code again for hours and it seems like the error lies wither in the Execute4Macro function or the VLookup function. Either way, there's no value being read into the ReturnedValue variable causing the exception handler to execute and giving me a mismatch error back up in the Cells.(...).Value assignment line.

    I'm also still confused about the ClosedRefReturnColumn Integer does?

    Here's my code so far:
    Please Login or Register  to view this content.
    Last edited by FRin323; 05-13-2011 at 08:55 AM. Reason: Code updated

+ 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