WorkBooks.add

  • Thread starter Thread starter Excel and VBA user
  • Start date Start date
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.
 
Hi

Try this

Sub test()
Dim OldValue As Integer
OldValue = Application.SheetsInNewWorkbook
Application.SheetsInNewWorkbook = 4
Workbooks.Add
Application.SheetsInNewWorkbook = OldValue
End Sub
 
Or, if you only want one worksheet, use this...Workbooks.Add(xlWorksheet)
 
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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top