+ Reply to Thread
Results 1 to 7 of 7

Copy sheet, rename with name and month increment

  1. #1
    Forum Contributor
    Join Date
    01-18-2012
    Location
    nr Salisbury, UK
    MS-Off Ver
    Excel 2010
    Posts
    126

    Copy sheet, rename with name and month increment

    I have a series of worksheets named “Test Jan 16”, “Test Feb 16” through to “Test Dec 16” there is also one named “Test Template 16”

    What I want to do is copy - insert and rename the “Test Template 16” sheet so I have a series of new sheets named “Test Jan 17”, “Test Feb 17” through to “Test Dec 17”. Ideally would like also if one does already exist, a Msg to say so but be able to continue with the others.
    Want to place them in sequence after the “Test Dec 16” sheet (which will not be the last sheet – maybe the 4 or 5 to last sheet)

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Copy sheet, rename with name and month increment

    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Forum Contributor
    Join Date
    01-18-2012
    Location
    nr Salisbury, UK
    MS-Off Ver
    Excel 2010
    Posts
    126

    Re: Copy sheet, rename with name and month increment

    Brilliant that will do exactly what I was wanting.

    But (isn’t there always) is it possible reference the last sheet of 2016 being “Test Dec 16” increase the 16 by 1 and then use that in the formatting of the new sheet name.

    Simply trying to avoid having to remember every year to change the Templates year suffix 16 to 17, 17 to 18 and so on (no big deal) but also have to go to the macro and change the
    Please Login or Register  to view this content.
    It is a minor point but just wondered if it’s possible

    As a side question what is the relevance of the reference to “A1” in the evaluate part?

  4. #4
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Copy sheet, rename with name and month increment

    Quote Originally Posted by julhs View Post
    Brilliant that will do exactly what I was wanting.

    But (isn’t there always) is it possible reference the last sheet of 2016 being “Test Dec 16” increase the 16 by 1 and then use that in the formatting of the new sheet name.
    Please Login or Register  to view this content.

    As a side question what is the relevance of the reference to “A1” in the evaluate part?
    The REF function requires a cell reference. The A1 cell is irrelevant in this case. It could be any cell. We simply want to test if the sheet name & cell reference is valid.

  5. #5
    Forum Contributor
    Join Date
    01-18-2012
    Location
    nr Salisbury, UK
    MS-Off Ver
    Excel 2010
    Posts
    126

    Re: Copy sheet, rename with name and month increment

    If a sheet already exists with a name of the intended series (Jan – Dec) Msg dialog informs you as wanted and goes on and creates the rest. Only snag is the sheets will not be in month order, grant you there are not many times it will happen or sheets to just manually reorder but can it be done after inserting new sheets. Beginning to wonder if I am making this way over complicated!!

  6. #6
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Copy sheet, rename with name and month increment

    Quote Originally Posted by julhs View Post
    Beginning to wonder if I am making this way over complicated!!
    I'm not wondering.

    You're welcome.

    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    01-18-2012
    Location
    nr Salisbury, UK
    MS-Off Ver
    Excel 2010
    Posts
    126

    Re: Copy sheet, rename with name and month increment

    Well what can I say other than FANTASTIC, does everything I wanted and with the cherry on the top.
    You have helped me out yet again. Many thanks
    I am just going to add a default message at the start to make it safe from fools like myself inadvertently adding new month sheets for the next 20 years due to the changes made to the index referencing

+ 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: 0
    Last Post: 02-09-2016, 03:04 PM
  2. [SOLVED] Copy a sheet, rename it by value in range then export product to new workbook and rename
    By MagicMan in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-31-2015, 07:24 PM
  3. Macro to copy sheet, then rename month name, then filter the results by that name
    By jateelover in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-01-2014, 05:31 PM
  4. Replies: 0
    Last Post: 06-28-2014, 02:26 PM
  5. [SOLVED] "copy worksheet from previous month and rename to current month" modified?
    By jerrydiaz in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-07-2013, 08:18 AM
  6. Macro to duplicate current sheet and incrementally rename by month
    By jerrydiaz in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-05-2013, 12:31 PM
  7. 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