+ Reply to Thread
Results 1 to 7 of 7

Bestway to create MULTIPLE worksheets that are IDENTICAL accept for their name

  1. #1
    Registered User
    Join Date
    05-31-2013
    Location
    England
    MS-Off Ver
    Excel 2003
    Posts
    83

    Bestway to create MULTIPLE worksheets that are IDENTICAL accept for their name

    I have some code that create 5 different works sheets "sheet 1", "Sheet 2",...... on each of these sheets I want to copy a header. I also have a number of variables that refer to each individual sheet, so Check1, Check2,.....

    Could I use an array or a simple loop to create these sheets to avoid replicating all of the data whilst maintain my individual variable references??

    Please Login or Register  to view this content.

    Thanking you in advance

    Jim

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Bestway to create MULTIPLE worksheets that are IDENTICAL accept for their name

    Hi, Jim,

    itīs not clear how your Checkx work and whatīs behind them. Maybe you can have a look at the code here which does fine for me using a loop:

    Please Login or Register  to view this content.
    I would prefer to set objects to the sheets, especially for Sheets(2) which doesnīt look like a very sound way to me (Sheets may be anything inclduign Charts which might be positioned as the second sheet in the workbook).

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  3. #3
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Bestway to create MULTIPLE worksheets that are IDENTICAL accept for their name

    One approach:

    Please Login or Register  to view this content.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  4. #4
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Bestway to create MULTIPLE worksheets that are IDENTICAL accept for their name

    Hi, Jerry,

    the basic idea was my first thought too (no, definitely not the array but to put the copying into the If-Statement as well). Thinking about it any change on Shets(2) would not have been copied over if the sheet in quesiton already existed so I put that piece outside to get that point covered as well.

    Just my thoughts about that point.

    Ciao,
    Holger

  5. #5
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Bestway to create MULTIPLE worksheets that are IDENTICAL accept for their name

    Good point, but I read his original macro as an incorrect approach since his IFERROR test didn't activate the already existing sheet, thus it was just copying the headers onto whatever the activesheet was, again. I figured that was a mistake and he simply wanted to create sheets if they were missing.

  6. #6
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Bestway to create MULTIPLE worksheets that are IDENTICAL accept for their name

    Hi, Jerry,

    good point as well (I would have preferred a template sheet to copy instead of adding empty sheets and copy rows over). Let Jim explain which one fits in better for his needs.

    Ciao,
    Holger

  7. #7
    Registered User
    Join Date
    05-31-2013
    Location
    England
    MS-Off Ver
    Excel 2003
    Posts
    83

    Re: Bestway to create MULTIPLE worksheets that are IDENTICAL accept for their name

    Hi Folks,

    sorry for the late response! I like both suggestions and both is better than what I have. ive attached a sheet that shows what im trying to accomplish, its very messy and im sure a few loops would tidy it all up but im unsure where and how to input them effectively.

    The idea is that when you click the button it:

    a) condenses the other sheets into a summary page and organises them in ascending order D4 - A1 think that's descending actually lol.
    b) then divides that summary sheet into separate years according what year there is a value present. obv some are repeated several times.

    there are also lines to copy headers and to ensure that certain headers are labelled according to the year. I want the module to be flexible so that I could copy it into other surveys with different years and more sites.

    Thank you for your help everyone
    Attached Files Attached Files

+ 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. Creating multiple identical worksheets
    By Brian Ferris in forum Excel General
    Replies: 2
    Last Post: 08-18-2017, 03:03 AM
  2. Identical worksheets, identical data, different arrangements
    By Hooty in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-21-2012, 05:02 PM
  3. Importing selective data from multiple identical worksheets to master.
    By nknam in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-17-2012, 06:56 PM
  4. How to create multiple month to date summaries from multiple worksheets
    By cmwilbur in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-28-2010, 02:56 PM
  5. Protection of identical cells on multiple worksheets
    By shawnlacey in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 05-16-2006, 04:15 PM

Tags for this Thread

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