Q: how to open new WB with just one sheet 
Author Message
 Q: how to open new WB with just one sheet

When creating a new Workbook, the number of sheets in it  comes with the
settings  made under Tools/Options.

But I want to create a new sheet from within my macro with just one sheet,
in disregard with the settings.

can anyone give the rigth syntax for this command?



Fri, 16 Nov 2001 03:00:00 GMT  
 Q: how to open new WB with just one sheet
Peter

The code below reads the current setting.  Opens a new book with one sheet
and resets the old setting.  This should get you started.

Sub insertOneSheet()
Dim oldSet As Integer
oldSet = Application.SheetsInNewWorkbook
Application.SheetsInNewWorkbook = 1
Workbooks.Add
Application.SheetsInNewWorkbook = oldSet
End Sub

--
HTH

Nick Hodge
Southampton, England


Quote:
> When creating a new Workbook, the number of sheets in it  comes with the
> settings  made under Tools/Options.

> But I want to create a new sheet from within my macro with just one sheet,
> in disregard with the settings.

> can anyone give the rigth syntax for this command?



Fri, 16 Nov 2001 03:00:00 GMT  
 Q: how to open new WB with just one sheet
Peter,

Workbooks.Add(xlWBATWorksheet)

...adds a new workbook based on Excel's internal single sheet template.

HTH

Rob

www.rb-ad.dircon.co.uk/xlhome.htm


Quote:
> When creating a new Workbook, the number of sheets in it  comes with the
> settings  made under Tools/Options.

> But I want to create a new sheet from within my macro with just one sheet,
> in disregard with the settings.

> can anyone give the rigth syntax for this command?



Fri, 16 Nov 2001 03:00:00 GMT  
 Q: how to open new WB with just one sheet
Thanks Nick, it works just like I wanted.



: Peter
:
: The code below reads the current setting.  Opens a new book with one
sheet
: and resets the old setting.  This should get you started.
:
: Sub insertOneSheet()
: Dim oldSet As Integer
: oldSet = Application.SheetsInNewWorkbook
: Application.SheetsInNewWorkbook = 1
: Workbooks.Add
: Application.SheetsInNewWorkbook = oldSet
: End Sub
:
: --
: HTH
:
: Nick Hodge
: Southampton, England

:


: > When creating a new Workbook, the number of sheets in it  comes with
the
: > settings  made under Tools/Options.
: >
: > But I want to create a new sheet from within my macro with just one
sheet,
: > in disregard with the settings.
: >
: > can anyone give the rigth syntax for this command?
: >
:
:
:



Fri, 16 Nov 2001 03:00:00 GMT  
 Q: how to open new WB with just one sheet
Rob,

this one is even shorter then the solution mentioned before and works as
well

Thanks a lot
k rgrds
Peter



: Peter,
:
: Workbooks.Add(xlWBATWorksheet)
:
: ...adds a new workbook based on Excel's internal single sheet template.



Fri, 16 Nov 2001 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Disk is full error message on copying sheets from one wb to another

2. Combining two sheet into one new sheet.

3. Macro to Copy 2 Wb Ranges into 3rd Wb.

4. Newbie Qs: importing key/value pairs from textfile AND checking for new files in a directory

5. 3 configuration Qs (status bar, http entries, File New)

6. Creating new sheet then renaming new sheet in VBA

7. Delete empty sheets in WB

8. Copy Sheet to another WB without activating it?

9. Is it possible to unprotect / protect a sheet in a shared WB

10. Checking for the same sheets in 2 WB's


 
Powered by phpBB® Forum Software © phpBB Group