+ Reply to Thread
Results 1 to 4 of 4

Consolidate 12 worksheets' code into workbook level

  1. #1
    Forum Contributor
    Join Date
    09-16-2009
    Location
    Glasgow, Scotland
    MS-Off Ver
    Excel XP, 2003, 2010
    Posts
    125

    Consolidate 12 worksheets' code into workbook level

    Hello Everyone,

    I have 12 worksheets, each with the same code doing the same thing. I understand it would be neater and have faster rendering times if I was to consolidate the code into a workbook level event.
    I have tried and tried again, however, I can't get it working quite right.
    The code works perfect in worksheet level but for reasons above I want it in workbook level.
    Any help would be most appreciated.

    Below is the code I have in each worksheet, none of the ranges change in each worksheet:

    Please Login or Register  to view this content.
    HAVE A VERY MERRY XMAS!!!

    Tony

  2. #2
    Registered User
    Join Date
    11-20-2009
    Location
    Raymond,WA
    MS-Off Ver
    Excel 2002
    Posts
    40

    Re: Consolidating 12 worksheets' code into workbook level

    Without knowing 'how' it fails, my guess would be that somewhere you are providing an incomplete reference to an object. That is, you need to qualify a reference somewhere by adding which worksheet the item you wish to reference is contained.
    (didn't look closely at your code, you may already be doing that everywhere it would be required)

  3. #3
    Forum Contributor
    Join Date
    09-16-2009
    Location
    Glasgow, Scotland
    MS-Off Ver
    Excel XP, 2003, 2010
    Posts
    125

    Re: Consolidating 12 worksheets' code into workbook level

    Apologies TimK, I must confess I'm not that clued up in VBA!

    I kinda understand what you are explaining but I'm at a loss at how I can begin to put it together at workbook level.

    The 12 sheets are between 'bookend sheets' named 'START' and 'END' and I was thinking that it would be quite straightforward to consolidate but alas no

    The reason I have the bookends is because the sheets names changes (apart from the START and END ones) every year. It's basically a holiday workbook for office managers use. So for example, a new year starts and the manager puts in a date of when the holiday year starts and this feeds into the 12 sheets, naming them to to the relavant month, so from next year it'll be JAN 2010, FEB 2010, MAR 2010 and so on. As we are still in 2009 atm, the sheets are named JAN 2009, FEB 2009 etc.

    How would I be able to reference all the sheets within the code?

    Thanks,
    Tony

  4. #4
    Registered User
    Join Date
    11-20-2009
    Location
    Raymond,WA
    MS-Off Ver
    Excel 2002
    Posts
    40

    Re: Consolidating 12 worksheets' code into workbook level

    Something like this:

    Please Login or Register  to view this content.
    Does this help?

+ 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