What is the syntax to create a new workbook?

Workbooks.Add
ActiveWorkbook.SaveAs “<C:\insertYourFilePathHere\<name for your new workbook>.xls>
‘example that creates a new workbook called myWorkbook in the Downloads Folder
Workbooks.Add
ActiveWorkbook.SaveAs "C:\Users\glestrade\Downloads\myWorkbook.xls"

To find a file path for a file, click here.

Advertisements

What is the syntax for adding a worksheet?

'to add a sheet at the very beginning of the Sheets tab
Worksheets.Add Before:=Worksheets(1)

'to add a sheet at the very beginning of the Sheets tab
Dim shtLast As Worksheet
Set shtLast = .Worksheets(.Worksheets.Count)
Set shtNew = Worksheets.Add(After:=shtLast)

'to add multiple sheets before the active sheet
ThisWorkbook.Worksheets.Add Count:=<number of sheets you want to add>

'to add a new sheet before the current active sheet
Dim sht as Worksheet
Set sht = ThisWorkbook.Worksheets.Add
sht.Name = "<name of new worksheet>"