Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Add Workbook with specific number of worksheets

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?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Add Workbook with specific number of 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)

"Linda Mac" wrote in message
...
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?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Add Workbook with specific number of worksheets

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



--
Regards Ron de Bruin
http://www.rondebruin.nl


"Linda Mac" wrote in message ...
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?



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Add Workbook with specific number of worksheets

numSh = application.SheetsInNewWorkbook
application.SheetsInNewWorkbook = 4
Workbooks.Add
application.SheetsInNewWorkbook = numSh

--
Regards,
Tom Ogilvy

"Linda Mac" wrote in message
...
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?



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Add Workbook with specific number of worksheets

You can remove the line Linda
Dim a As Integer


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Ron de Bruin" wrote in message ...
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



--
Regards Ron de Bruin
http://www.rondebruin.nl


"Linda Mac" wrote in message ...
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?





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
link to a specific worksheet of a workbook with many worksheets eva cheng Excel Discussion (Misc queries) 1 November 27th 09 04:51 PM
Is there a maximum of the number of worksheets in a workbook? CYNTHIA Excel Discussion (Misc queries) 6 December 18th 07 02:46 PM
number worksheets in workbook sherobot Excel Discussion (Misc queries) 1 February 14th 07 09:21 PM
Counting the number of Worksheets in a Workbook Bill from Holland Michigan Excel Worksheet Functions 2 October 13th 06 12:14 AM
Count the number of worksheets in a workbook Vincdc Excel Discussion (Misc queries) 7 January 17th 05 11:57 PM


All times are GMT +1. The time now is 04:36 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"