+ Reply to Thread
Results 1 to 4 of 4

Need a Macro that can paste text from one workbook into any open workbook

  1. #1
    Registered User
    Join Date
    12-29-2017
    Location
    Seattle
    MS-Off Ver
    Office 2016
    Posts
    5

    Need a Macro that can paste text from one workbook into any open workbook

    Hello,

    I apologize if this is not something that is possible as I am new to Excel Macros.

    My question/issue. On a monthly basis I have a disclaimer that needs to be added to recently downloaded workbooks (28 in total). Currently, I have to open up each workbook, copy the disclaimer from a separate workbook, and then "Right Click>Insert Copied Cells>Shift Cells Down>Save Workbook".

    When I attempt to create a macro that does this automatically, it always references the workbook which I created the Macro in, as opposed to the current workbook I have open.

    Is there a way to reference whatever workbook I have open?

    Sorry if the post is long, Thank you!

  2. #2
    Forum Expert
    Join Date
    10-02-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    1,222

    Re: Need a Macro that can paste text from one workbook into any open workbook

    ActiveWorkbook is the keyword for whichever workbook is currently "active" or at the forefront of your screen. ActiveSheet can be used for the sheet in the active workbook that has focus.

    Are these 28 workbooks always in the same folder together? Are they the only files in said folder?

    Is the disclaimer always the exact same?

    Does the disclaimer always go in the same place in each workbook?

    I ask due to the following:

    If the files are in a folder of their own, IE folder with only those 28 files, then you could create a loop that opens each file in that folder, inserts your disclaimer and closes the 28 files fairly easily/quickly. If the disclaimer is always the same you could simply store it as a constant in a macro and "copy" it from the constant to each file. If it goes in the same place in each file that really makes it simple.

    If you could provide sample(s) including a couple samples (2-4 files?) of the 28 files, the disclaimer text (doesnt have to be exact, but similar to what you want), any code you already have and maybe a sample of what finished output would look like we could work something out to accomplish what you want.
    Ways to get help: Post clear questions, explain your overall goal, supply as much background as possible, respond to questions asked of you by those trying to help and post sample(s) files.

    "I am here to help, not do it for people" -Me

  3. #3
    Registered User
    Join Date
    12-29-2017
    Location
    Seattle
    MS-Off Ver
    Office 2016
    Posts
    5

    Re: Need a Macro that can paste text from one workbook into any open workbook

    Wow, that would save me so much time! The team has been doing this 1 file at a time for years and I just started 2 weeks ago. This would be great!

    I have attached some images that will hopefully clarify.

    1. Yes, all 28 files are kept in the same folder.
    2. Yes, the disclaimer is the same every time I add it.
    3. Yes, the disclaimer is added onto the same sheet for each workbook, into cell A1.
    4. I forgot to add, They are the only workbooks in the folder.

    Image 2 is the disclaimer. I need to add cell range (A1:L15) to cell A1 of the top workbook

    Image 3 is my attempt at the macro. As you can see the error is that it is referencing a book that is no longer open. However I want it to run the macro in the currently open workbook.

    1.
    Excel Help.JPG
    2.
    Excel Help 02.JPG
    3.
    Attempted Macro.JPG
    Last edited by bachmap; 12-29-2017 at 02:58 PM. Reason: Cleaning up my mess

  4. #4
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,151

    Re: Need a Macro that can paste text from one workbook into any open workbook

    Quote Originally Posted by bachmap View Post
    ... disclaimer is added onto sheet ... into cell A1 ...
    ...
    ...I need to add cell range (A1:L15) to cell A1 of the top workbook ...
    ? What does it mean ?

+ 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. 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
  3. 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
  4. Replies: 13
    Last Post: 11-29-2012, 08:25 PM
  5. [SOLVED] Copying worksheet from another open workbook using variables, paste to active workbook
    By sanpedro_nz in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-08-2012, 08:25 AM
  6. Replies: 2
    Last Post: 09-11-2012, 09:42 AM
  7. retrieve object from multiple closed workbook and paste into open workbook.
    By niailmar in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-22-2012, 12:31 AM

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