Add a worksheet and save it : Worksheet Add « Excel « VBA / Excel / Access / Word






Add a worksheet and save it

 

Sub NewWorkbook()
  Dim myWorksheet As Worksheet
  With Workbooks.Add
    Set myWorksheet = .Worksheets.Add(After:=.Sheets(.Sheets.Count))
    myWorksheet.Name = "January"
    myWorksheet.Range("A1").Value = "Sales Data"
    .SaveAs Filename:="JanSales.xls"
  End With
End Sub

 








Related examples in the same category

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