+ Reply to Thread
Results 1 to 5 of 5

Macro to add worksheet - worksheet names change

  1. #1
    Registered User
    Join Date
    09-12-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    3

    Macro to add worksheet - worksheet names change

    I have searched extensively on this forum and Google for a few days and cannot find anything that will work. I am trying to create a macro that will add a worksheet into a workbook and copy the data from an existing worksheet onto the new worksheet. The problem I'm having is that the worksheet names change over time. The workbook is used to track certain products, with one workbook for each product. Here is a visual of what I am trying to do:

    Starting worksheet tabs:
    |Summary| |2012| |2011| |2010|

    I want to add a new tab for 2013 that has the same data as the 2012 tab:
    |Summary| |2013| |2012| |2011| |2010|

    For next year, I will want to add a 2014 tab without having to rewrite the macro for each product's workbook.

    Any help would be greatly appreciated. I sincerely apologize if this information is readily available and I just missed it.

  2. #2
    Forum Expert
    Join Date
    08-02-2013
    Location
    Québec
    MS-Off Ver
    Excel 2003, 2007, 2013
    Posts
    1,412

    Re: Macro to add worksheet - worksheet names change

    Hi and welcompe to the forum....

    Something like this ?
    Please Login or Register  to view this content.
    GC Excel

    If this post helps, then click the star icon (*) in the bottom left-hand corner of my post to Add reputation.

  3. #3
    Registered User
    Join Date
    09-12-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Macro to add worksheet - worksheet names change

    Quote Originally Posted by GC Excel View Post
    Hi and welcompe to the forum....

    Something like this ?
    Please Login or Register  to view this content.
    Thanks for the suggestion, but it does not work. It gets stuck at Set ws = Sheets.Add(before:=Sheets(CStr(Year(Date)))).

  4. #4
    Forum Expert
    Join Date
    08-02-2013
    Location
    Québec
    MS-Off Ver
    Excel 2003, 2007, 2013
    Posts
    1,412

    Re: Macro to add worksheet - worksheet names change

    The macro looks for a tab named with the current year (2013), copies it and renames it to 2014
    Do you have a sheet named "2013" ?

  5. #5
    Registered User
    Join Date
    09-12-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Macro to add worksheet - worksheet names change

    I see, I can work with that. Thanks for your help!

+ 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: 07-24-2015, 08:33 AM
  2. [SOLVED] Worksheet Names macro that pastes names as hyperlinks
    By bungaree in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-04-2013, 07:15 PM
  3. Excel 2007 : Worksheet Tab Names Change
    By elecates in forum Excel General
    Replies: 0
    Last Post: 06-26-2008, 02:56 PM
  4. [SOLVED] In Excel, how do I change worksheet headers (A,B) to names (Box)?
    By Tom McGuire in forum Excel - New Users/Basics
    Replies: 4
    Last Post: 01-18-2006, 01:45 PM
  5. VBA Code to change worksheet names
    By Restitus in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 01-25-2005, 04:01 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