+ Reply to Thread
Results 1 to 12 of 12

VBA - Create New Sheets Based on Index Sheet Cell Values with Link to Index Sheet

  1. #1
    Registered User
    Join Date
    01-05-2017
    Location
    Atlanta, GA
    MS-Off Ver
    2016 Professional
    Posts
    4

    VBA - Create New Sheets Based on Index Sheet Cell Values with Link to Index Sheet

    Greetings -

    I'm trying to come up with a one click VBA solution that does the following:

    Takes each cell name from every non-blank cell in column "A" listed on an "index" sheet and creates a new worksheet with the same name as the sheet name. In cell "A1" on each new worksheet there should be a hyperlink labeled "home" to the original "index" sheet. There may be multiple existing sheets in the workbook, but this index sheet is always the first sheet and any existing worksheets should be ignored. Also, the "index" worksheet name, workbook name, and cell values are variable and may be different. Finally, and blank cells in column A1 should be ignored when running VBA.


    Example:

    An existing workbook titled "variablewb" contains 3 worksheets titled ws1, ws2 and ws3. "ws1" is the first sheet in the workbook and is our "index". In worksheet "ws1" the cells a2, a5, a6, and a10 contain the values "bob", "steve", "frank", and "andy", respectively. All other cells are blank in this example, but this can differ along with the cell values and sheet/workbook name.

    When the VBA function is run:

    * 4 new sheets titled "bob", "steve", "frank", and "andy" (respectively) should be created and placed in the workbook after the existing 3 sheets.
    * Each of the new 4 sheets should have a hyperlink in cell "a1" that will take user back to the index worksheet.
    * After the new sheets are created and the hyperlink is inserted, the user should be return to the index worksheet without the need to click on the hyperlink we created.


    Hope this is enough information, and I appreciate the assistance.
    Attached Files Attached Files
    Last edited by order; 01-05-2017 at 02:56 PM. Reason: added files

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,936

    Re: VBA - Create New Sheets Based on Index Sheet Cell Values with Link to Index Sheet

    Test post, was able to open both supplied files
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,936

    Re: VBA - Create New Sheets Based on Index Sheet Cell Values with Link to Index Sheet

    No, 1 of our members was having problems opening this thread, we were just testing to see if there is a problem - it seems not

  4. #4
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: VBA - Create New Sheets Based on Index Sheet Cell Values with Link to Index Sheet

    .
    .
    Paste this code into a regular module:

    Please Login or Register  to view this content.
    Not all of the code you were looking for. I'm looking at the hyperlink portion.
    Attached Files Attached Files
    Last edited by Logit; 01-05-2017 at 06:05 PM.

  5. #5
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,520

    Re: VBA - Create New Sheets Based on Index Sheet Cell Values with Link to Index Sheet

    Give this a try. hyperlink will take you to the index sheet and the cell with the sheet name

    Please Login or Register  to view this content.
    Last edited by mike7952; 01-05-2017 at 09:44 PM.
    Thanks,
    Mike

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved.

  6. #6
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: VBA - Create New Sheets Based on Index Sheet Cell Values with Link to Index Sheet

    .
    .
    With this code, paste into a routine module:

    Please Login or Register  to view this content.
    SAVE A COPY OF THIS FILE BEFORE RUNNING IT !
    Attached Files Attached Files

  7. #7
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: VBA - Create New Sheets Based on Index Sheet Cell Values with Link to Index Sheet

    Mike:

    Thank you for your suggestion !

  8. #8
    Registered User
    Join Date
    01-05-2017
    Location
    Atlanta, GA
    MS-Off Ver
    2016 Professional
    Posts
    4

    Re: VBA - Create New Sheets Based on Index Sheet Cell Values with Link to Index Sheet

    Quote Originally Posted by Logit View Post
    .
    .
    With this code, paste into a routine module:
    Very close to what I need, and thank you for your effort. Three things are not exactly as desired, so if you're able to make the following adjustments, that would be much appreciated:

    1) Ideally, the code would work regardless of the name of the index worksheet. It appears that if I change the name of the worksheet within Excel, the macro no works. The actual data sets I'm working with generate worksheet names that differ based on the date and data properties, so it's important that the sheet name can be variable.

    2) The macro should account for any blank cells in "Column A"...meaning if I add a blank row(s) between any two of the names, the macro will simply skip/ignore the blank row and continue through the rest of the cells in "column A" that have data

    3) In the "Tabs Dynamically Create_.xlsm" file you provided the cell number of data should not change. The only cell values on the index page will be the value of the first sheet of the workbook. Specifically in you attached file, "Sheet1", "Sheet2", and "Sheet3" should not be included in the index page, rather the index sheet should only have the 6 names listed beginning in cell A2. Capture.PNG

  9. #9
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: VBA - Create New Sheets Based on Index Sheet Cell Values with Link to Index Sheet

    .
    .
    This code will accomplish all but one need of your project.The part I'm still working on is the blank cells in the column list.

    I'll keep working at it but if someone else wants to jump in on that part ... please do.

    Just as an aside ... if we deleted the blank cells in names list before running the macro, would that cause a problem with your
    project ?

    Please Login or Register  to view this content.
    Attached Files Attached Files

  10. #10
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: VBA - Create New Sheets Based on Index Sheet Cell Values with Link to Index Sheet

    .
    .
    Here's the last part to your project. The attachment has everything but for future reference for readers, the SUB RenameTabs
    now has this code. Can anyone suggest any definitive improvement to the syntax ?

    Please Login or Register  to view this content.
    Attached Files Attached Files

  11. #11
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,520

    Re: VBA - Create New Sheets Based on Index Sheet Cell Values with Link to Index Sheet

    Will take a look later this evening.

  12. #12
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: VBA - Create New Sheets Based on Index Sheet Cell Values with Link to Index Sheet

    Thanks for the Add Rep

+ 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 Help needed to create sheet based on master sheet column cell values
    By krjoshi in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 03-12-2016, 04:58 PM
  2. [SOLVED] Create new sheet from template, auto fill from index sheet and hyperlink
    By RichTea88 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-06-2013, 04:57 AM
  3. Create VLOOKUP or INDEX/MATCH to copy values from Sheet 2 to Sheet 1
    By leog1969 in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 04-03-2013, 05:58 PM
  4. [SOLVED] Creating a loop that copies values from one sheet to another based on an index function.
    By ndrobinson in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-27-2013, 06:19 PM
  5. How to create and populate sheets based upon cell values in master sheet?
    By mezzopiano1423 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-12-2013, 12:51 PM
  6. Replies: 2
    Last Post: 01-14-2013, 06:30 AM
  7. Replies: 1
    Last Post: 11-18-2009, 08:12 AM

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