+ Reply to Thread
Results 1 to 11 of 11

auto generate titles to multiple sheets from a list

Hybrid View

dtorres4043 auto generate titles to... 10-19-2015, 10:06 AM
HangMan Re: auto generate titles to... 10-19-2015, 11:00 AM
HangMan Re: auto generate titles to... 10-19-2015, 11:13 AM
dtorres4043 Re: auto generate titles to... 10-19-2015, 11:15 AM
HangMan Re: auto generate titles to... 10-19-2015, 11:56 AM
dtorres4043 Re: auto generate titles to... 10-19-2015, 12:00 PM
HangMan Re: auto generate titles to... 10-19-2015, 05:42 PM
dtorres4043 Re: auto generate titles to... 10-21-2015, 11:27 AM
HangMan Re: auto generate titles to... 10-21-2015, 11:37 AM
dtorres4043 Re: auto generate titles to... 10-21-2015, 11:41 AM
HangMan Re: auto generate titles to... 10-21-2015, 11:43 AM
  1. #1
    Registered User
    Join Date
    10-19-2015
    Location
    Houston, Texas
    MS-Off Ver
    MS Office 2013
    Posts
    5

    Question auto generate titles to multiple sheets from a list

    Hello, all,

    I have a worksheet that includes a list of 275 schools. Each school name corresponds to a separate worksheet, all in the same workbook. There are therefore 276 tabs. What I would like to do is copy the contents of the list so that each school name appears on its corresponding tab. The order of the list and tabs is the same.

    Is there a way to do this in Excel?

    dtorres4043

  2. #2
    Forum Contributor
    Join Date
    06-21-2010
    Location
    -
    MS-Off Ver
    Excel 2010
    Posts
    1,211

    Re: auto generate titles to multiple sheets from a list

    If all your worksheets are already set up and say for example the sheet containing the list of sheet names is called 'Sheet Names' and your other 275 tabs are called Sheet2, Sheet3, Sheet4 and so on, you could add the existing Sheet Names in a column next to your new Sheet Names like this, so coulmn A is the new Sheet Name and column B is the current sheet name:

    sheetnames.jpg

    and then add this macro

    Sub RenameWorksheets()
        For i = 1 To 275
            On Error Resume Next
            Oldame = Cells(i, 2).Value
            Newname = Cells(i, 1).Value
            Sheets(Oldname).Name = Newname
        Next
    End Sub
    If you only currently have one worksheet containing the list of worksheet names and want to generate 275 worksheets named as per you list you could use this, assuming your list of names are in column A on a worksheet called 'Sheet Names'. Change the worksheet name holding your list and the list range in the code below to match what you have:

    Sub NameWorksheets()
        Dim MyCell As Range, MyRange As Range
         
        Set MyRange = Sheets("Sheet Names").Range("A1:A275")
        Set MyRange = Range(MyRange, MyRange.End(xlDown))
    
        For Each MyCell In MyRange
            Sheets.Add After:=Sheets(Sheets.Count) 'Creates a new worksheet
            Sheets(Sheets.Count).Name = MyCell.Value ' Renames the new worksheet
        Next MyCell
    End Sub
    Last edited by HangMan; 10-19-2015 at 11:04 AM.
    Thanks,
    HangMan

    You can say "Thank you!" by clicking Add Reputation below the post.
    Please, mark your thread [SOLVED] if you are happy with the solution.

  3. #3
    Forum Contributor
    Join Date
    06-21-2010
    Location
    -
    MS-Off Ver
    Excel 2010
    Posts
    1,211

    Re: auto generate titles to multiple sheets from a list

    Just re-read your post an realised this probably is not what you are trying to achieve, I think you actually just want to add the name of each school onto its associated tab rather than rename the tabs themselves...

  4. #4
    Registered User
    Join Date
    10-19-2015
    Location
    Houston, Texas
    MS-Off Ver
    MS Office 2013
    Posts
    5

    Re: auto generate titles to multiple sheets from a list

    HangMan,

    Yes, you're correct. I want to add the names in my list to a specific cell on each worksheet. I do not want to rename the tabs.

  5. #5
    Forum Contributor
    Join Date
    06-21-2010
    Location
    -
    MS-Off Ver
    Excel 2010
    Posts
    1,211

    Re: auto generate titles to multiple sheets from a list

    Are your worksheets called by the names of the schools, i.e. does you list of names match the names of your worksheets or are the worksheet names different to the names of the schools?

  6. #6
    Registered User
    Join Date
    10-19-2015
    Location
    Houston, Texas
    MS-Off Ver
    MS Office 2013
    Posts
    5

    Re: auto generate titles to multiple sheets from a list

    The worksheet tabs have DIFFERENT (i.e., generic) names than my list of schools. Because I'm using full school names, I couldn't use the names on the tabs due to length limits for the tab string.

  7. #7
    Forum Contributor
    Join Date
    06-21-2010
    Location
    -
    MS-Off Ver
    Excel 2010
    Posts
    1,211

    Re: auto generate titles to multiple sheets from a list

    It's difficult without seeing an actual sample and knowing whether you want the name to always appear in the same cell on each sheet and knowing whether the names on your school list are in the same order as the sheets themselves, i.e. Sheet2 is School 2, Sheet3 is School 3 and so on, but you could try the following, assuming your School Names currently appear in Sheet1, column A.

    Insert a column before your School Names list so that your school names appear in column B to give you something resembling this...

    schoolnames.jpg

    Print the names of all your worksheets in column A using this macro

    Sub SheetNames()
        For i = 2 To Sheets.Count
            Cells(i, 1) = Sheets(i).Name
        Next i
    End Sub
    to give you something like this...

    sheetnames.jpg

    Assuming the sheet containing your school names is called 'School Names' (change to your actual sheet name in the formula below) and you want the name of the school to appear in cell A1 on each sheet (adjust to the appropriate cell reference in the formula if not). Select the second tab in your Workbook, hold the Shift key down and then select the last tab in your workbook so you have all 275 sheets selected. Click in cell A1 (or whichever cell you want the School Names to appear in) and paste this formula and hit Enter.

    =VLOOKUP(REPLACE(CELL("filename",A1),1,FIND("]",CELL("filename",A1)),""),'School Names'!$A$2:$B$276,2,FALSE)
    and see if that gives you what you need. If not perhaps you can upload a sample...
    Last edited by HangMan; 10-21-2015 at 11:44 AM.

  8. #8
    Registered User
    Join Date
    10-19-2015
    Location
    Houston, Texas
    MS-Off Ver
    MS Office 2013
    Posts
    5

    Re: auto generate titles to multiple sheets from a list

    HangMan,

    Thanks. I think something like what you just gave would be very helpful. When I run the macro, however, it is replacing what is in column B. I'm not very adept at using excel macros, so I don't know what the problem is.

    D

  9. #9
    Forum Contributor
    Join Date
    06-21-2010
    Location
    -
    MS-Off Ver
    Excel 2010
    Posts
    1,211

    Re: auto generate titles to multiple sheets from a list

    My mistake, change

    Cells(i, 2) = Sheets(i).Name
    to

    Cells(i, 1) = Sheets(i).Name
    Sub SheetNames()
        For i = 2 To Sheets.Count
            Cells(i, 1) = Sheets(i).Name
        Next i
    End Sub
    and give it another go...

  10. #10
    Registered User
    Join Date
    10-19-2015
    Location
    Houston, Texas
    MS-Off Ver
    MS Office 2013
    Posts
    5

    Re: auto generate titles to multiple sheets from a list

    Thanks so very much. That worked like a charm and saved me from a tedious afternoon.
    Cheers,
    D

  11. #11
    Forum Contributor
    Join Date
    06-21-2010
    Location
    -
    MS-Off Ver
    Excel 2010
    Posts
    1,211

    Re: auto generate titles to multiple sheets from a list

    Happy to help...

    If that has answered your question and solved the problem, can you mark as 'Solved'.

+ 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. Auto-Generate List from reference cells based on data validation list selection
    By BoundCustomDesign in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 05-13-2014, 11:06 AM
  2. [SOLVED] Generate a pending list from multiple sheets
    By stevense28 in forum Excel General
    Replies: 11
    Last Post: 03-26-2014, 02:27 PM
  3. Is there a way to auto sort and generate sheets?
    By ccovemaker in forum Excel General
    Replies: 2
    Last Post: 12-29-2012, 04:28 AM
  4. Replies: 5
    Last Post: 09-30-2012, 07:47 AM
  5. Auto-populate to Master list from Multiple sub sheets
    By 614984 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-18-2012, 04:18 PM
  6. [SOLVED] Splitting datasets by their titles into multiple sheets
    By ad9051 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 04-15-2012, 09:00 AM
  7. Excel Generate List from Multiple Sheets
    By Scorpio in forum Excel General
    Replies: 5
    Last Post: 05-16-2008, 01:20 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