Create a new sheet with month name and year as its name : Worksheet Add « Excel « VBA / Excel / Access / Word






Create a new sheet with month name and year as its name

 
Sub Add_Sheet()
    Dim myWorksheet As Worksheet
    Dim myWorksheetName As String
    myWorksheetName = Format(Now, "mmmm_yyyy")
    For Each myWorksheet In Worksheets
        If myWorksheet.Name = myWorksheetName Then
            MsgBox "Sheet already exists...Make necessary " & _
                "corrections and try again."
            Exit Sub
        End If
    Next myWorksheet
        Sheets.Add.Name = myWorksheetName
        Sheets(myWorksheetName).Move After:=Sheets(Sheets.Count)
        Sheets("Sheet1").Range("A1:A5").Copy Sheets(myWorksheetName).Range("A1")
End Sub

 








Related examples in the same category

1.Add a new sheet with name in A1
2.Add a new Sheet
3.Creating a new worksheet for your workbook, and then it fills in several cells in that new worksheet.
4.Inserts new monthly sheet
5.Add a worksheet and append value
6.Add a worksheet and save it
7.Append a worksheet to the end of the worksheet list