+ Reply to Thread
Results 1 to 13 of 13

Copy Same Sheet to Multiple Workbooks in Folder

  1. #1
    Registered User
    Join Date
    08-03-2013
    Location
    New York, USA
    MS-Off Ver
    Excel 2012
    Posts
    6

    Copy Same Sheet to Multiple Workbooks in Folder

    Hello!

    I need help with vba code. I have to insert the same sheet to over 100 workbooks. Instead of opening all the workbooks and copying the sheet is there a way I can use VBA to insert the sheet to all the excel files?

    Thank you!!!

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Copy Same Sheet to Multiple Workbooks in Folder

    I don't know of a way to copy a sheet to a closed workbook.

    A macro could open each workbook in a folder, copy the one sheet, and save\close the workbook.

    If you want help with that macro, record a macro where you manually do all the steps (open, copy sheet, save, close) for one workbook from the folder. Then post the code for the recorded macro here. Remember to surround your pasted code with CODE tags (it's a forum rule). See my signature block below.

    Someone here can then change your recorded macro to loop through all the workbooks in the folder.
    Last edited by AlphaFrog; 04-01-2014 at 01:38 PM.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

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

    Re: Copy Same Sheet to Multiple Workbooks in Folder

    Maybe:

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    08-03-2013
    Location
    New York, USA
    MS-Off Ver
    Excel 2012
    Posts
    6

    Re: Copy Same Sheet to Multiple Workbooks in Folder

    Recorded the macro: Wanted to move "Sheet1" to "Workbook" file.

    THANKS!!

    Sub CopySheet()
    '
    ' CopySheet Macro
    '

    '
    Sheets("Sheet1").Select
    Sheets("Sheet1").Copy After:=Workbooks("Workbook"). _
    Sheets(4)
    End Sub

  5. #5
    Registered User
    Join Date
    08-03-2013
    Location
    New York, USA
    MS-Off Ver
    Excel 2012
    Posts
    6

    Re: Copy Same Sheet to Multiple Workbooks in Folder

    Hey John,

    The code worked perfectly! Is there a way to retain the name of the Sheet? When I move the sheets over it renames it to ‘Sheet1’ instead of the original name ‘Formulas’.

    Thank you so much!! This will save me a lot of time, really appreciate it!!



    Quote Originally Posted by JOHN H. DAVIS View Post
    Maybe:

    Please Login or Register  to view this content.

  6. #6
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Copy Same Sheet to Multiple Workbooks in Folder

    Quote Originally Posted by allie14 View Post
    Recorded the macro: Wanted to move "Sheet1" to "Workbook" file.

    THANKS!!

    Sub CopySheet()
    '
    ' CopySheet Macro
    '

    '
    Sheets("Sheet1").Select
    Sheets("Sheet1").Copy After:=Workbooks("Workbook"). _
    Sheets(4)
    End Sub

    Well, so much for using CODE tags.

    Did you try John's solution? EDIT: disregard.

  7. #7
    Registered User
    Join Date
    08-03-2013
    Location
    New York, USA
    MS-Off Ver
    Excel 2012
    Posts
    6

    Re: Copy Same Sheet to Multiple Workbooks in Folder

    Sorry it's my first time posting! Forgive me.


    Quote Originally Posted by AlphaFrog View Post
    Well, so much for using CODE tags.

    Did you try John's solution? EDIT: disregard.

  8. #8
    Registered User
    Join Date
    08-03-2013
    Location
    New York, USA
    MS-Off Ver
    Excel 2012
    Posts
    6

    Re: Copy Same Sheet to Multiple Workbooks in Folder

    Nevermind I got it to work figured it out!

    Thank you again! Love you guys!!

    Quote Originally Posted by allie14 View Post
    Hey John,

    The code worked perfectly! Is there a way to retain the name of the Sheet? When I move the sheets over it renames it to ‘Sheet1’ instead of the original name ‘Formulas’.

    Thank you so much!! This will save me a lot of time, really appreciate it!!

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

    Re: Copy Same Sheet to Multiple Workbooks in Folder

    Glad to hear it works for you and thanks for the feedback. Please comply with Forum Rule No. 9.


    9. Acknowledge the responses you receive, good or bad. If your problem is solved, please say so clearly, and mark your thread as Solved: Click Thread Tools above your first post, select "Mark your thread as Solved". Or click the Edit button on your first post in the thread, Click Go Advanced, select [SOLVED] from the Prefix dropdown, then click Save Changes. If more than two days have elapsed, the Dropdown option or Edit button will not appear -- ask a moderator to mark it.

  10. #10
    Registered User
    Join Date
    08-03-2013
    Location
    New York, USA
    MS-Off Ver
    Excel 2012
    Posts
    6

    Re: Copy Same Sheet to Multiple Workbooks in Folder

    The code copies and paste it directly to the workbooks.

    Is there a way I can move the active sheet tab to worksheets and keep the formatting and printing options (the same everything) instead of copying and pasting?

    I saw the code below, but I don’t know how to incorporate it into the code. Many thanks!!


    Please Login or Register  to view this content.
    ActiveSheet.Move Before:=Workbooks("Test.xls").Sheets(1)
    'Moves active sheet to beginning of named workbook.
    'Replace Test.xls with the full name of the target workbook you want.
    Please Login or Register  to view this content.
    Quote Originally Posted by JOHN H. DAVIS View Post
    Glad to hear it works for you and thanks for the feedback. Please comply with Forum Rule No. 9.


    9. Acknowledge the responses you receive, good or bad. If your problem is solved, please say so clearly, and mark your thread as Solved: Click Thread Tools above your first post, select "Mark your thread as Solved". Or click the Edit button on your first post in the thread, Click Go Advanced, select [SOLVED] from the Prefix dropdown, then click Save Changes. If more than two days have elapsed, the Dropdown option or Edit button will not appear -- ask a moderator to mark it.

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

    Re: Copy Same Sheet to Multiple Workbooks in Folder

    Maybe:

    Please Login or Register  to view this content.

  12. #12
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Copy Same Sheet to Multiple Workbooks in Folder

    Quote Originally Posted by JOHN H. DAVIS View Post
    Maybe:

    Please Login or Register  to view this content.
    I don't mean to step on anyone's toes, but I don't think you want to reference the workbook Test.xls

    Maybe try something like this. It copies the worksheet to the opened workbook's tab position 1.

    Please Login or Register  to view this content.

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

    Re: Copy Same Sheet to Multiple Workbooks in Folder

    Good catch AlfaFrog. Looks like my toes needed some stepping on.

+ 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. Replies: 3
    Last Post: 10-24-2012, 06:41 AM
  2. Copy worksheet to multiple workbooks in a folder
    By MysticGenius in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-12-2012, 07:10 AM
  3. copy & paste data from multiple workbooks to new workbook in a folder
    By Ignesh in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-01-2012, 03:11 AM
  4. create a compressed folder or zipped folder then copy workbooks to it.
    By Ironman in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-04-2012, 03:56 PM
  5. copy first sheet from all workbooks in folder
    By Steel Monkey in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-15-2011, 02:59 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