+ Reply to Thread
Results 1 to 3 of 3

Insert sheet, move to end, rename with cell data.

  1. #1
    cht13er@gmail.com
    Guest

    Insert sheet, move to end, rename with cell data.

    I've spent most of my day trying to ask VB to do this for me, but don't
    know how to communicate it correctly.

    I have column A in "List"(Sheet1) with 150 entries.
    I want to create 150 sheets with Sheet numbers of 2-151.
    However, I would like for the tabs to read what the appropiate cell in
    "List" says....

    ie if
    +++
    (column A)
    ___
    Fun
    Not Fun
    Cool
    +++
    was my column, I would like the first four tabs to read "List" (my
    original sheet), "Fun", "Not Fun", and "Cool".

    Then they would appear in Microsoft Visual Basic as Sheet1(List),
    Sheet2(Fun), Sheet3(Not Fun), and Sheet4(Cool).

    This doesn't need to be a macro - I think a sub would work easier.
    Thanks for your help!

    Chris T.


  2. #2
    Dave O
    Guest

    Re: Insert sheet, move to end, rename with cell data.

    Here's code to do it- note that the names in List must all be valid tab
    names.

    Sub Add_From_List()
    Dim Nayme As String
    Dim K As Byte
    K = 1


    Range("a1").Select 'this is the first cell in List

    Do Until ActiveCell.Value = "" 'Loop until a blank cell is encountered
    Nayme = ActiveCell.Value
    Sheets.Add
    ActiveSheet.Name = Nayme
    Sheets(Nayme).Move After:=Sheets(K + 1)
    Sheets("List").Select
    ActiveCell.Offset(1, 0).Select
    K = K + 1
    Loop
    End Sub


  3. #3
    cht13er@gmail.com
    Guest

    Re: Insert sheet, move to end, rename with cell data.

    Anyone else who uses this code, note also that you will delete Sheet2
    and Sheet3 before running the macro.

    Some of the tab name problems are length (31 letters) and symbols like
    (){}*.

    Thanks a lot, Dave O! The code was great.


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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