• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Adding a new workbook with set number of sheets

So according to the VBA help use the Worksheets.Add method with its Count parameter or you can update​
the SheetsInNewWorkbook property (to see in VBA help like in threads of this forum) before creating a new workbook.​
 
Instead of:
Code:
Set WSNew = Workbooks.Add(xlWBATWorksheet).Worksheets(1)
try:
Code:
SINWOrig = Application.SheetsInNewWorkbook 'store current setting
Application.SheetsInNewWorkbook = 4 'change setting
Set WSNew = Workbooks.Add.Worksheets(1) 'add workbook
Application.SheetsInNewWorkbook = SINWOrig 'restore setting to original
 
Thank you for the replies guys. I got it sorted out. The original writer of the code got back to me and helped me.
 
Back
Top