+ Reply to Thread
Results 1 to 6 of 6

Create a new worksheet by copying another tab with all the codes

  1. #1
    Registered User
    Join Date
    09-07-2010
    Location
    dallas
    MS-Off Ver
    Excel 2003
    Posts
    29

    Create a new worksheet by copying another tab with all the codes

    Hi,

    I am attempting to write a small code for the following scenario..

    I have a workbook with worksheets GP1, GP2, GP3 etc & a template page as the last tab.
    All the worksheets column names are same but have different data.
    Last worksheet is the template for all of them. How do I create
    a command button in template page... upon clicking the button,
    it should create a tab just before the template worksheet incrementing
    previous tab GP3 +1-> GP4. GP4 should be a copy of the template page
    along with all the vb codes associated with the template page.

    So tabs looks like=> GP1, GP2, GP3, GP4, template

    Any sample code would be nice!

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Create a new worksheet by copying another tab with all the codes

    Hi loneman,

    Perhaps:

    Please Login or Register  to view this content.
    Last edited by xladept; 05-05-2014 at 04:46 PM.
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Registered User
    Join Date
    09-07-2010
    Location
    dallas
    MS-Off Ver
    Excel 2003
    Posts
    29

    Re: Create a new worksheet by copying another tab with all the codes

    Thank you xladept!!!! Code works except one small issue. I wanted to get the worksheet name as follows.
    If the worksheets are GP1, GP2, GP3.. GP50.. etc.) & (template worksheet)... for the new worksheet name, 2 letters, GP, stays the same but the number increments to next number.. If I have the following worksheets existing:

    GP1, GP2, GP3, template => the new worksheet name to be GP4 (GP & 3 +1).... right now the code gives me GP31.. how can I update the code get this outcome?

  4. #4
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Create a new worksheet by copying another tab with all the codes

    Sorry - try:

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    09-07-2010
    Location
    dallas
    MS-Off Ver
    Excel 2003
    Posts
    29

    Re: Create a new worksheet by copying another tab with all the codes

    Thanks a million!!

  6. #6
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Create a new worksheet by copying another tab with all the codes

    You're welcome!

+ 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. [SOLVED] Need to create unique pin codes
    By Tsheik in forum Excel Formulas & Functions
    Replies: 22
    Last Post: 09-21-2021, 12:31 AM
  2. VBA codes for copying certain cells from many workbooks
    By samirelsabagh in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-17-2013, 08:55 PM
  3. copying bold data from sheet1 to create new worksheets and rename the worksheet
    By ramdzan in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 03-03-2011, 11:33 AM
  4. Create random codes
    By yrndtn in forum Excel General
    Replies: 8
    Last Post: 06-01-2010, 05:08 PM
  5. Trying to create codes
    By baf3472 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-29-2007, 12:29 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