Excel VBA Add Set of Worksheets Automatically

There is a time when we must create a set of Excel Worksheets templates on a regular basis in our work. For example, a set of Excel Worksheet for each month of the year or may be based on the type of work we should done in certain time base.

Here a simple example of how to create a new set 12 Worksheets for each month of the year.

Sub CreateMonthlyWorksheetTemplate()
    Dim ix As Integer, oSheet As Worksheet, sMonth As String

    For ix = 1 To 12

        'add new worksheet
        Set oSheet = Worksheets.Add

        'get month name from index
        sMonth = Format("1/" & CStr(ix), "mmm")

        'rename the new worksheet
        oSheet.Name = sMonth

        Set oSheet = Nothing
    Next ix

End Sub

Read also a previous post about how vba add worksheet complete with error handler when we counter duplicate Worksheet.

This entry was posted in Workbook and Worksheet and tagged , , . Bookmark the permalink.

1,208 Responses to Excel VBA Add Set of Worksheets Automatically

  1. Pingback: gogo games

  2. Pingback: "fun tasticdental

  3. Pingback: servis char

  4. Pingback: Symbol DS6707 Bar Code Scanner

  5. Pingback: mens ring

  6. Pingback: diabetic bags

  7. Pingback: advertisers

  8. Pingback: ew3109w

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>