+ Reply to Thread
Results 1 to 7 of 7

"copy worksheet from previous month and rename to current month" modified?

  1. #1
    Registered User
    Join Date
    08-10-2012
    Location
    NY
    MS-Off Ver
    Excel 2010
    Posts
    78

    "copy worksheet from previous month and rename to current month" modified?

    Hi-

    There already exists an 8-year old thread using the following code to copy worksheet and rename to current month at http://www.excelforum.com/excel-prog...ent-month.html using the following code:

    Please Login or Register  to view this content.
    I need this exact function, with the one modification that I don't want the year included. When I remove the "yyyy" from the "mmmm yyyy" in the DateAdd function, it fails unless the existing sheet name already contains a year.

    Thanks

  2. #2
    Forum Contributor
    Join Date
    03-21-2013
    Location
    Corvallis, OR
    MS-Off Ver
    Excel 2010
    Posts
    174

    Re: "copy worksheet from previous month and rename to current month" modified?

    Maybe I'm misunderstanding this, but to get the date out of the previous sheet name, it would have to contain a year. You could change the function completely and revolve around the month in a 1-12 cycle, but that would fail once you had 12 sheets... Why do you want the year excluded?

  3. #3
    Registered User
    Join Date
    08-10-2012
    Location
    NY
    MS-Off Ver
    Excel 2010
    Posts
    78

    Re: "copy worksheet from previous month and rename to current month" modified?

    Because the company standard is to have each of the 12 tabs contain just the month name.

    We have a new workbook every year with 12 months.

    Is there a way to accomplish this?

  4. #4
    Registered User
    Join Date
    08-10-2012
    Location
    NY
    MS-Off Ver
    Excel 2010
    Posts
    78

    Re: "copy worksheet from previous month and rename to current month" modified?

    Anybody? Please?

  5. #5
    Forum Contributor
    Join Date
    03-21-2013
    Location
    Corvallis, OR
    MS-Off Ver
    Excel 2010
    Posts
    174

    Re: "copy worksheet from previous month and rename to current month" modified?

    Yes, you could have a hidden sheet with a list of month names in the appropriate order, then in the macro, add the name of the last sheet to a cell on the same sheet which is reference using a formula like this: say the last sheet name is put in cell B1 and the list of months is in cells A1:A12, the formula would be:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    , which would return the month following the last sheet. Keep in mind that the formula would return a blank value once the last sheet hit December, unless you add another January to the bottom of the list of months. Based on what you've said about creating a new book for each calendar year, I assume you wouldn't need this option though.
    Anyway, the value returned by this formula could be referenced by your macro to name the next sheet. I'll try to modify the code you have to do this for you based on a hidden sheet called "dates".

  6. #6
    Forum Contributor
    Join Date
    03-21-2013
    Location
    Corvallis, OR
    MS-Off Ver
    Excel 2010
    Posts
    174

    Re: "copy worksheet from previous month and rename to current month" modified?

    Here, try this code:
    Please Login or Register  to view this content.
    It works in a test book I have designed like I suggested with months contained in a hidden sheet titled "dates". The code does the work of the formula so that you don't have to worry about it; all you need is a list of months in A1:A12. I hope this helps!

  7. #7
    Registered User
    Join Date
    08-10-2012
    Location
    NY
    MS-Off Ver
    Excel 2010
    Posts
    78

    Re: "copy worksheet from previous month and rename to current month" modified?

    Thank you SO much!!

+ 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. Need the previous "Last Modified", not the current
    By viperisback in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-21-2013, 12:25 PM
  2. Replies: 12
    Last Post: 06-10-2013, 05:42 PM
  3. Macro using vlookups comparing 2 months paysheet(previous month and current month)
    By srinivasan1965 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-07-2012, 03:45 AM
  4. Replies: 5
    Last Post: 10-04-2012, 07:06 AM
  5. [SOLVED] copy worksheet from previous month and rename to current month
    By Dan E. in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-08-2005, 05: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