+ Reply to Thread
Results 1 to 2 of 2

What is the quickest method to insert & name multiple worksheets .

  1. #1
    clyonesse
    Guest

    What is the quickest method to insert & name multiple worksheets .

    Need to create several spreadsheets ... each requiring multiple worksheets.

    EXAMPLE: Monthly spreadsheets will require separate worksheets for each day
    of that month ... Jan-1; Jan-2; Jan-3 ... Jan-31

    Aside from inserting/copying/naming each worksheet on an individual basis
    (too time-consuming) ... is there a quicker method to create/insert/name all
    the worksheets needed within a workbook ?

  2. #2
    Registered User
    Join Date
    06-21-2004
    Location
    Phoenix, Az
    Posts
    30

    Lightbulb

    Here is a macro and function which will create new sheets for
    each value found in column A of worksheet "SheetList"

    -Create the "SheetList" sheet and in column A enter the names of sheets you want to add
    - Run the macro "Main"

    Sub Main()
    Dim SheetList As Object, counter As Integer
    Set SheetList = ThisWorkbook.Sheets("SheetList")
    For counter = 1 To SheetList.UsedRange.Rows.Count
    Call CreateSheet(SheetList.Cells(counter, 1).Value)
    Next counter
    End Sub

    Function CreateSheet(ByVal sname As String)
    On Error GoTo endfunction
    Dim ns As Object
    Set ns = ThisWorkbook.Sheets.Add(, ActiveSheet)
    ns.Name = sname
    Exit Function
    endfunction:
    End Function

+ 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