+ Reply to Thread
Results 1 to 5 of 5

Open external workbook and copy paste from it

  1. #1
    Forum Contributor
    Join Date
    02-10-2012
    Location
    Newcastle upon Tyne
    MS-Off Ver
    Excel 2021
    Posts
    114

    Open external workbook and copy paste from it

    Hi,

    I have the following recorded code to open, copy and paste the data required to specific destination, however the file name and/or destination may change... is there a way of setting the code so it pops up with a file open screen so I can select the relevant workbook?

    The following will remain unchanged:

    Sheet name - "Sheet1"
    Range to copy - "A1:BM500"
    Paste destination sheet "QL_TB"

    Please Login or Register  to view this content.
    Many thanks in advance

  2. #2
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: Open external workbook and copy paste from it

    Hi colin
    try this code
    The code will open a dialog to select your wb and then copy the range("A1:BM500") from the selected workbook
    The copied data will be pasted in the workbook which has the code in sheets("QL_TB")
    Hope it is the required
    Please Login or Register  to view this content.
    Regards

  3. #3
    Forum Contributor
    Join Date
    02-10-2012
    Location
    Newcastle upon Tyne
    MS-Off Ver
    Excel 2021
    Posts
    114

    Re: Open external workbook and copy paste from it

    Hi Yasser,

    This works perfectly, however the format of the copied cells are completely different - is there any way of retaining the formatting?

    Thanks very much

  4. #4
    Forum Contributor
    Join Date
    02-10-2012
    Location
    Newcastle upon Tyne
    MS-Off Ver
    Excel 2021
    Posts
    114

    Re: Open external workbook and copy paste from it

    Actually - it's ok, this still works for what I need - thanks again!

  5. #5
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: Open external workbook and copy paste from it

    Hi colin
    to retain the formatting you can replace this line
    Please Login or Register  to view this content.
    with these lines to paste copied data as values only
    Please Login or Register  to view this content.
    Regards

+ 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. Macro VBA to copy and paste cells from one open workbook to another open workbook
    By bloomingcarrot in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-23-2014, 07:55 PM
  2. Open workbook, filter values, copy/paste into Active workbook.
    By niceguy21 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-10-2013, 12:17 PM
  3. Replies: 2
    Last Post: 09-11-2012, 09:42 AM
  4. [SOLVED] copy from external file, paste in current workbook
    By rodich in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-16-2012, 04:29 AM
  5. Simple task: Open a workbook, copy a range, paste into another workbook
    By fbonetti in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-21-2011, 01:12 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