+ Reply to Thread
Results 1 to 6 of 6

Copy Worksheet to New Workbook Based on Worksheet Name

  1. #1
    Registered User
    Join Date
    01-10-2012
    Location
    Detroit, Michigan
    MS-Off Ver
    Excel 2010
    Posts
    62

    Copy Worksheet to New Workbook Based on Worksheet Name

    Hi all,

    I'm trying to write a code that searches the active workbook for sheet names that end in "budget" and add them to a new workbook. Then I would like to delete the sheets that were copied from the active workbook. Here is what i have but it doesn't work (I'm sure there are many reasons why). Any help would be appreciated.

    Please Login or Register  to view this content.

    Thanks!

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

    Re: Copy Worksheet to New Workbook Based on Worksheet Name

    Maybe:

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    01-10-2012
    Location
    Detroit, Michigan
    MS-Off Ver
    Excel 2010
    Posts
    62

    Re: Copy Worksheet to New Workbook Based on Worksheet Name

    John,

    This is currently not working, I just realized that a previous part of my code is exiting the sub. Would I be able to create a new module for this sub and call it to run once the previous sub is exited? If so, could you provide a code to add at the end to call this one to run?

    This is the reason it exits;
    Please Login or Register  to view this content.

    Thanks

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

    Re: Copy Worksheet to New Workbook Based on Worksheet Name

    Not sure I understand. Try this:

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    01-10-2012
    Location
    Detroit, Michigan
    MS-Off Ver
    Excel 2010
    Posts
    62

    Re: Copy Worksheet to New Workbook Based on Worksheet Name

    John,

    This move of sheets is part of a much larger code, it is actually the last thing I need it to do. Due to the way this code works I can't use the above example. I was just asking if there is a way to call a second sub upon the exit of another sub. I appreciate your time and will work through a solution myself unless you have any input. The first code you gave me works beautifully, much thanks!

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

    Re: Copy Worksheet to New Workbook Based on Worksheet Name

    The only input I could provide is if you want to call vrs exit itself, Or if the condition ws.Range("Q190") > 0 would be required before running the macro I suggested then you would call it at the very end of your existing sub routine. Hope that helps?

+ 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: 4
    Last Post: 11-23-2014, 11:13 AM
  2. Replies: 8
    Last Post: 10-27-2014, 11:27 PM
  3. Copy Worksheet from Another Workbook based on Cell Value
    By greasybob in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-02-2014, 05:52 PM
  4. [SOLVED] copy from another workbook's worksheet based on column name.
    By Jhail83 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 08-01-2013, 11:30 AM
  5. Copy text from set range in one worksheet to named worksheet in another workbook
    By Steven811 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-25-2013, 10:55 AM
  6. Replies: 2
    Last Post: 12-26-2012, 09:36 AM
  7. Replies: 5
    Last Post: 06-08-2012, 11:26 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