+ Reply to Thread
Results 1 to 4 of 4

Browse a File, Copy Selected data from it and paste it to other workbook (Active)

  1. #1
    Registered User
    Join Date
    08-17-2012
    Location
    Lisbon, Portugal
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    82

    Browse a File, Copy Selected data from it and paste it to other workbook (Active)

    Hello again guys,

    Here's a new doubt..hehe. I'm finishing a project that I started yesterday. The first part is all done, the part that I need help is the one in the subject, i.e., I need to browse a file, open it, copy selected data from Sheet2 and paste it to the 2nd sheet of my active workbook, copy selected data from sheet3 and paste it to the 3rd sheet of my active workbook and finally close the book I opened without saving changes.

    This kind of code is too hard to me to understand at this point. I did a lot of research and come up to this code which is some way similiar to what I require:

    Please Login or Register  to view this content.

    This code browses a File, copy the entire sheet1 from the book I opened to a newly created Sheet1 of my Active workbook, name it "Copied Sheet" and closes the book wb2 without saving changes.
    I think I can use some of the code, but then adapt it to my case.

    Therefore what I need is something more speficic in this part, i think:


    Please Login or Register  to view this content.

    Specifications:

    Sheet2
    What I need to copy from Sheet2 of wb2 is
    Please Login or Register  to view this content.
    And paste it to Sheet 2 of my Active workbook at
    Please Login or Register  to view this content.

    Sheet3
    What I need to copy from Sheet3 of wb2 is
    Please Login or Register  to view this content.
    And paste it to Sheet 3 of my Active Workbook at
    Please Login or Register  to view this content.

    Please let me know if I was not clear enough or if you have some doubts about it.
    Looking forward for a feedback.
    Many thanks.


    Kind Regards,
    FCarv

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Browse a File, Copy Selected data from it and paste it to other workbook (Active)

    Sheet2
    wb2.Sheets(2).Range("A5:H" & ActiveSheet.UsedRange.SpecialCells(xlCellTypeLastCell).Row).copy _Activeworkbook.Sheets(2).Range("B8:I" & ActiveSheet.UsedRange.SpecialCells(xlCellTypeLastCell).Row)
    If solved remember to mark Thread as solved

  3. #3
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Browse a File, Copy Selected data from it and paste it to other workbook (Active)

    Sheet2
    wb2.Sheets(2).Range("A5:H" & ActiveSheet.UsedRange.SpecialCells(xlCellTypeLastCell).Row).copy Activeworkbook.Sheets(2).Range("B8:I" & ActiveSheet.UsedRange.SpecialCells(xlCellTypeLastCell).Row)

  4. #4
    Registered User
    Join Date
    08-17-2012
    Location
    Lisbon, Portugal
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    82

    Re: Browse a File, Copy Selected data from it and paste it to other workbook (Active)

    Thank you patel45.
    I have just changed a little bit the code, because it was copying the data and don't know why was doing the paste in the same workbook that it copied , i.e. wb2 and not in the wb1, like it was meant to be.

    Please Login or Register  to view this content.
    wb1 was set earlier as the Activeworkbook

    Please Login or Register  to view this content.
    Nevertheless, problem SOLVED


    Rgds,
    FCarv

+ 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