WorkBooks.add

E

Excel and VBA user

Is it possible to set how many sheets are in a workbook
when you use Workbooks.Add. Or can I set the sheetcount
without writing a loop to add the amount of sheets.
 
R

Ron de Bruin

Hi

Try this

Sub test()
Dim OldValue As Integer
OldValue = Application.SheetsInNewWorkbook
Application.SheetsInNewWorkbook = 4
Workbooks.Add
Application.SheetsInNewWorkbook = OldValue
End Sub
 
R

Ron de Bruin

Or, if you only want one worksheet, use this...Workbooks.Add(xlWorksheet)

Or this

Workbooks.Add (1)
a higher number is not working

Or

Workbooks.Add (xlWBATWorksheet)
 
Top