+ Reply to Thread
Results 1 to 3 of 3

Simultaneously add sheets to multiple workbooks

  1. #1
    Registered User
    Join Date
    05-08-2012
    Location
    Calgary
    MS-Off Ver
    Excel 2003
    Posts
    13

    Simultaneously add sheets to multiple workbooks

    I have 3 different workbooks: MonthlyTracking.xls, MonthlySEMReport.xls, and MonthlyTrackingStatsCanReport.xls
    Each of these workbooks have sheets named for each month (Mar 2012)
    I want to use my NewMonth macro in MonthlyTracking.xls to call the similar functions in the other workbooks so they will all have a new sheet added to them at the same time.

    This is the code that I thought would do it:

    'other code above this creates a sheet in MonthlyTracking.xls
    Application.Run "MonthlySEMReport.xls!NewMonthSEM"
    Application.Run "MonthlyTrackingStatsCanReport.xls!NewMonthSC"

    But it just adds 3 sheets to MonthlyTracking.xls
    Is there a way I can do this?

  2. #2
    Registered User
    Join Date
    05-08-2012
    Location
    Calgary
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Simultaneously add sheets to multiple workbooks

    This is what I've tried now:
    Please Login or Register  to view this content.
    It is giving me "Subscript out of range" on the first call of "Application.Sheets(sSheetName).Activate"
    What am I doing wrong here?
    Last edited by arlu1201; 05-09-2012 at 01:59 PM. Reason: Please put code tags in future.

  3. #3
    Registered User
    Join Date
    05-08-2012
    Location
    Calgary
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Simultaneously add sheets to multiple workbooks

    Turns out I was changing the ActiveSheet.name before calling "sSheetName = ActiveSheet.name"
    So I moved this line to before the name change and it works now.

+ 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