Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Workbooks.add command

Status
Not open for further replies.

robcarr

Programmer
May 15, 2002
633
GB
Dear All,

Currently when I use the workbooks.add command, I get 3 sheets added(my default setting), is there a way to specify how many sheets to create when the workbook is added, currently I have to add all sheets by using the Sheets.Add command.

Thanks for any help on this.

Rob.
 
This should do it, if you don't add the Bold statements, the default sheet count will be forever altered. Just kidding, you can change manually by selecting Tools - Options - Genereal - Sheets In New Workbook.

Dim NewSheets As Long, OldSheets As Long

OldSheets = Application.SheetsInNewWorkbook
NewSheets = InputBox("Enter required number of worksheets", "Number of Workssheets in Workbook")
Application.SheetsInNewWorkbook = NewSheets
Workbooks.Add
Application.SheetsInNewWorkbook = OldSheets

Cheers,

Dave
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top