+ Reply to Thread
Results 1 to 3 of 3

Copy Active Worksheet into Multiple Workbooks in Separate Folder

  1. #1
    Registered User
    Join Date
    09-29-2014
    Location
    Minneapolis, MN
    MS-Off Ver
    2011 Mac OS
    Posts
    3

    Copy Active Worksheet into Multiple Workbooks in Separate Folder

    I have been trying for two days to run a macro that will copy the active worksheet from one workbook into multiple workbooks that are in a separate folder. I'm unfamiliar with VBA and macros, so have been searching the web looking for code that will work. I've tried SEVERAL combos, but nothing is working. I either get a "Runtime Error 68" or "Compile Error Sub or Function not defined".

    I'm using Excel 2010 on MacOS Mavericks. Any guidance would be most appreciated.


    Here's the most recent code I've been trying:

    Option Explicit

    Public Sub CopySheetToAllWorkbooksInFolder()

    Dim sourceSheet As Worksheet
    Dim folder As String, FileName As String
    Dim destinationWorkbook As Workbook

    'Worksheet in active workbook to be copied as a new sheet to the 160 workbooks

    Set sourceSheet = ActiveWorkbook.Worksheets("Updates to Existing Copy")

    'Folder containing the 160 workbooks

    folder = "ENTER FOLDER NAME HERE" 'Note: I have updated as necessary but left for purposes of this question.

    FileName = Dir(folder)
    While Len(FileName) <> 0
    Debug.Print folder & FileName
    Set destinationWorkbook = Workbooks.Open(folder & FileName)
    sourceSheet.Copy before:=destinationWorkbook.Sheets(1)
    destinationWorkbook.Close True
    FileName = Dir() ' Get next matching file
    Wend

    End Sub

  2. #2
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,528

    Re: Copy Active Worksheet into Multiple Workbooks in Separate Folder

    @ FinkKosek.
    Please read the Forum Rules. In your case pay special attention to #3.

  3. #3
    Registered User
    Join Date
    09-29-2014
    Location
    Minneapolis, MN
    MS-Off Ver
    2011 Mac OS
    Posts
    3

    Re: Copy Active Worksheet into Multiple Workbooks in Separate Folder

    I have been trying for two days to run a macro that will copy the active worksheet from one workbook into multiple workbooks that are in a separate folder. I'm unfamiliar with VBA and macros, so have been searching the web looking for code that will work. I've tried SEVERAL combos, but nothing is working. I either get a "Runtime Error 68" or "Compile Error Sub or Function not defined".

    I'm using Excel 2010 on MacOS Mavericks. Any guidance would be most appreciated.


    Here's the most recent code I've been trying:

    Please Login or Register  to view this content.

+ 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. Copy value from multiple workbooks in the same folder
    By starchris4 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-17-2014, 07:21 PM
  2. [SOLVED] Open Multiple Workbooks, Record names, Copy paste to Active Workbook, Close the Workbooks
    By vba_madness in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-24-2013, 06:09 AM
  3. 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
  4. VBA Copy Active worksheet to all workbooks in folder
    By adainty in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-19-2011, 12:24 PM
  5. Copy worksheet to all workbooks in specified folder
    By nosstech in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-12-2009, 03:45 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