+ Reply to Thread
Results 1 to 14 of 14

Generate new worksheets from cell names and populate them with relevant info.

  1. #1
    Forum Contributor
    Join Date
    09-11-2008
    Location
    uk
    MS-Off Ver
    365
    Posts
    424

    Generate new worksheets from cell names and populate them with relevant info.

    Guys,

    Hope you can help me out once again!

    The attached workbook contains several sheets....one master named Event_final, 3 worksheets which are dummy templates, and one named Choices which is used to derive the data validation in b2-u2 of the Event_final worksheet.

    In the Event_final worksheet rows b1-u1 are headings and then the drop downs.
    Underneath each drop down there are a variable amounts of cells containing various bits and bobs.

    What I can't seem to find or do, is.... a) make a new spreadsheet for each column, called whatever is the column title (b1-u1), b) copy whatever template identified in the corresponding drop down box to that new sheet (b2-u2), and c) and then populate each new worksheet with the corresponding column contents starting at say cell B2 on each of the new sheets.

    I have attached a workbook with only 2 examples of the required output...(red tabs...see file named samplemore), but obviously I would like the remaining worksheet to be also generated!!!

    Hope this make sense, and thanks for looking.

    Skyping
    Attached Files Attached Files
    Last edited by skyping; 08-27-2013 at 06:46 PM. Reason: more requirements

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Generate new worksheets from cell names and populate them with relevant info.

    attach please desired result
    If solved remember to mark Thread as solved

  3. #3
    Forum Contributor
    Join Date
    09-11-2008
    Location
    uk
    MS-Off Ver
    365
    Posts
    424

    Re: Generate new worksheets from cell names and populate them with relevant info.

    Please see original post which I have updated.

  4. #4
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,784

    Re: Generate new worksheets from cell names and populate them with relevant info.

    Based on your first uploaded work book I've written a macro that creates worksheets when there are values in the appropriate column i.e. will generate a worksheet named "Mens Doubles" but not a sheet named "Womens Doubles" as there are no values in column E aside from heading.

    Re sheet names be aware that ":" is not a permitted sheet name so I've striped away the "Event: " part. A sheet name has also a maximum length of 31 letters and signs.

    To test run macro "AddSheet". If this solution could be of use to you specify the changes you wish to have and I'll see if this could be implemented.

    Alf
    Attached Files Attached Files

  5. #5
    Forum Contributor
    Join Date
    09-11-2008
    Location
    uk
    MS-Off Ver
    365
    Posts
    424

    Re: Generate new worksheets from cell names and populate them with relevant info.

    Hi Alf,

    Thank you very much for your help.

    Your macro is exactly what I wanted prior to the changes that I forgot to mention in post 1 (before I edited it!).

    Would it be possible to adapt your macro to fulfill the changes? e.g. so that it could work for my file "sample_more" and copy the relevant template into each of the new worksheets?

    Once again, thanks for all your help.

    Skyping

  6. #6
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,784

    Re: Generate new worksheets from cell names and populate them with relevant info.

    Would it be possible to adapt your macro to fulfill the changes?
    Hopefully yes but first I need to check with you that I do understand your problem properly.

    The first sheet is "Event_final" then you have 3 template sheets and one "Choices" sheet.

    The sheets you wish to add will all be put at the end i.e. after the "Choices" sheet and their names taken from row 1 sheet "Event_final".

    The values in each column should be copied from row 3 down as far as the value goes i.e. 6 or 5 or whatever and pasted into the new sheet at cell B2.

    If row 2 sheet "Event_final" contains a value i.e. "Template_abc", "Template_chips" or "Template_fish" the active range for the appropriate template should be copied to the new sheet as well.

    So looking at "Template_abc" what is the active range? Cells B6:J20 or cells B10:J20? And where should this range be copied to cell C6 or cell D10 on the "Mens Singles" sheet?

    I need the same information for the other two template sheets.

    Final question what should happen if you wish to do a rerun of the macro? One way would be to let the macro start by deleting all sheets except "Event_final", the 3 template sheets and the "Choices" sheet and the rebuild everything based on new or changed values in "Event_final" sheet.

    Alf

  7. #7
    Forum Contributor
    Join Date
    09-11-2008
    Location
    uk
    MS-Off Ver
    365
    Posts
    424

    Re: Generate new worksheets from cell names and populate them with relevant info.

    Hi Alf,

    Thanks for getting back to me.

    You are completely right in all your assumptions, except of the range of the various templates to be copied.

    I intend for all generated sheets to have various lengths of entries starting from B2 and going down that column....this indicates the entries per event, as you have rightly stated.

    All the templates (full versions) will start at C1 and go to z68 and I would like them to be pasted at the same location on the generated sheets, I simply put the dummy ones into my sample file for ease.

    Additionally it would be great if when rerunning the macro, all of the previously generated sheets can be removed except of course the original ones.

    Once again thanks for all your help.

    Skyping

  8. #8
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,784

    Re: Generate new worksheets from cell names and populate them with relevant info.

    Ok got all information I need so I'll have a go at solving this.

    Alf

  9. #9
    Forum Contributor
    Join Date
    09-11-2008
    Location
    uk
    MS-Off Ver
    365
    Posts
    424

    Re: Generate new worksheets from cell names and populate them with relevant info.

    Thanks Alf.

  10. #10
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,784

    Re: Generate new worksheets from cell names and populate them with relevant info.

    Ok her comes the new code. I've tested it on your last uploaded file andas far as I can see it works the way you wish it should do.

    Macro starts by deleting all sheets except for "Event_final", the 3 template sheets and the "Choices" sheet.

    Checks the number of used columns in sheet "Event_final" and loops through these columns creating new sheets if row 3 is not empty. It also copies the used range in each used column starting at row 2 and going down. Values are pasted to range B1 in new sheet. If there is a value in B1 the appropriate template sheet and range are copied to the new sheet and then cell B1 content is deleted.

    There is someting funny with your data columns E, F, G and all the others that looks empty is not so because checking with vba it seems there are some invicible signs in thes columns as vba tells that the first 6 rows are filled.

    Please Login or Register  to view this content.
    Alf

  11. #11
    Forum Contributor
    Join Date
    09-11-2008
    Location
    uk
    MS-Off Ver
    365
    Posts
    424

    Re: Generate new worksheets from cell names and populate them with relevant info.

    Hi Alf,

    Thank you so much for your excellent code...its exactly want I was looking for!!!

    I greatly appreciate the work you have put into this, and I am continuing learning from you experts.

    SOLVED

  12. #12
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,784

    Re: Generate new worksheets from cell names and populate them with relevant info.

    Thanks for feedback and rep!

    Alf

  13. #13
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,784

    Re: Generate new worksheets from cell names and populate them with relevant info.

    Glancing at my code I see I've forgotten to add the line

    Please Login or Register  to view this content.
    at the start of the macro, if you also missed it just add the line before the

    Please Login or Register  to view this content.
    line. Sorry about that.

    Alf

  14. #14
    Forum Contributor
    Join Date
    09-11-2008
    Location
    uk
    MS-Off Ver
    365
    Posts
    424

    Re: Generate new worksheets from cell names and populate them with relevant info.

    Good spot Alf....Thanks.

+ 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] VBA to copy relevant data and populate a template sheet
    By kenadams378 in forum Excel Programming / VBA / Macros
    Replies: 21
    Last Post: 01-31-2013, 02:08 PM
  2. Replies: 2
    Last Post: 09-30-2012, 12:55 AM
  3. How to generate + populate new worksheets according to cell value
    By SouthKensington in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 01-28-2011, 10:54 PM
  4. Auto populate list of names from various worksheets
    By shuttletech in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-08-2011, 09:44 AM
  5. Displaying relevant info according to output
    By WomanInWhite in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-10-2006, 02:25 AM

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