Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi, I wanted to use Workbooks.Add to create a new, blank
output workbook but it always creates it with the default 3 sheets, how can I create it with just 1 sheet. The finished Workbook will have more sheets added later in the routine but the workbook will be used by others that may have the default set to a different value |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Try something like
Dim NewSheets As Integer NewSheets = Application.SheetsInNewWorkbook Application.SheetsInNewWorkbook = 1 Workbooks.Add Application.SheetsInNewWorkbook = NewSheets -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Newboy18" wrote in message ... Hi, I wanted to use Workbooks.Add to create a new, blank output workbook but it always creates it with the default 3 sheets, how can I create it with just 1 sheet. The finished Workbook will have more sheets added later in the routine but the workbook will be used by others that may have the default set to a different value |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks, that was the fastest reply I ever had.
Turns out that all I needed was the 1 line Application.SheetsInNewWorkbook = 1 Then my Workbooks.Add -----Original Message----- Try something like Dim NewSheets As Integer NewSheets = Application.SheetsInNewWorkbook Application.SheetsInNewWorkbook = 1 Workbooks.Add Application.SheetsInNewWorkbook = NewSheets -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Newboy18" wrote in message ... Hi, I wanted to use Workbooks.Add to create a new, blank output workbook but it always creates it with the default 3 sheets, how can I create it with just 1 sheet. The finished Workbook will have more sheets added later in the routine but the workbook will be used by others that may have the default set to a different value . |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The command sets the users options in Tools=Options to 1, so now whenever
they add a workbook, it will have 1 sheet. The reason Chip gave you the additional lines of code was so you would reset the number of sheets back to what the user originally had. Not using all the code would result in extremely ill behaved code. An easier way to do it without changing the users settings is: Workbooks.Add xlWBATWorksheet This will add a one sheet workbook. -- Regards, Tom Ogilvy "Newboy18" wrote in message ... Thanks, that was the fastest reply I ever had. Turns out that all I needed was the 1 line Application.SheetsInNewWorkbook = 1 Then my Workbooks.Add -----Original Message----- Try something like Dim NewSheets As Integer NewSheets = Application.SheetsInNewWorkbook Application.SheetsInNewWorkbook = 1 Workbooks.Add Application.SheetsInNewWorkbook = NewSheets -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Newboy18" wrote in message ... Hi, I wanted to use Workbooks.Add to create a new, blank output workbook but it always creates it with the default 3 sheets, how can I create it with just 1 sheet. The finished Workbook will have more sheets added later in the routine but the workbook will be used by others that may have the default set to a different value . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Updating Workbooks from multiple links Workbooks | Excel Worksheet Functions | |||
Copy/ move selected data from workbooks to seperate worksheets or workbooks | Excel Worksheet Functions | |||
Display 2 formulas from source workbooks to destination workbooks | Excel Discussion (Misc queries) | |||
suddenly my excel workbooks are "shared workbooks" | Excel Discussion (Misc queries) | |||
Workbooks.Open closes other workbooks | Excel Programming |