Add Workbook with specific number of worksheets

  • Thread starter Thread starter Linda Mac
  • Start date Start date
L

Linda Mac

I want to do a Workbook.Add to add a new workbook and I
want it to have 4 worksheets in the workbook. How can I
force it to have 4 worksheets?
 
Hi Linda,

It's not hard

Application.SheetsInNewWorkbook = 4
Workbooks.Add


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Hi linda

Try this

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

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