Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Saving only 1 sheet of a workbook

How do I save only 1 sheet of a workbook into a new file

I tried
Worksheets("Save Sheet").Saveas Filename:="save.xls"

The above for some reason is saving all sheets and macros, not just the one
I requested it save.

Thanks
---
Jay Wilson
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Saving only 1 sheet of a workbook

Jay,

One way

Application.DisplayALerts = False

For each sh in Activeworkbok.sheets
if sh.name < "Save Sheet" Then
sh.delete
end If
Next sh

Activeworkbook.Saveas Filename:="save.xls

Application.DisplaAlerts = True

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Jay Wilson" wrote in message
...
How do I save only 1 sheet of a workbook into a new file

I tried
Worksheets("Save Sheet").Saveas Filename:="save.xls"

The above for some reason is saving all sheets and macros, not just the

one
I requested it save.

Thanks
---
Jay Wilson



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Saving only 1 sheet of a workbook

Bob

Will this snippet of code also remove the macros? I don't want them in the
saved copy.

Thanks
---
Jay Wilson


On Mon, 2 Feb 2004 16:04:33 -0000, Bob Phillips wrote:

Jay,

One way

Application.DisplayALerts = False

For each sh in Activeworkbok.sheets
if sh.name < "Save Sheet" Then
sh.delete
end If
Next sh

Activeworkbook.Saveas Filename:="save.xls

Application.DisplaAlerts = True

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Saving only 1 sheet of a workbook

No, it will only remove any code in the sheets not being saved. To remove
code, use
Dim VBComp As VBIDE.VBComponent
Dim VBComps As VBIDE.VBComponents

Set VBComps = ActiveWorkbook.VBProject.VBComponents

For Each VBComp In VBComps
Select Case VBComp.Type
Case vbext_ct_StdModule, vbext_ct_MSForm, _
vbext_ct_ClassModule
VBComps.Remove VBComp
Case Else
With VBComp.CodeModule
.DeleteLines 1, .CountOfLines
End With
End Select
Next VBComp

You will need to set a reference to the Microsoft Visual Basic For
Applications Extensibility.

--

HTH


Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Jay Wilson" wrote in message
...
Bob

Will this snippet of code also remove the macros? I don't want them in

the
saved copy.

Thanks
---
Jay Wilson


On Mon, 2 Feb 2004 16:04:33 -0000, Bob Phillips wrote:

Jay,

One way

Application.DisplayALerts = False

For each sh in Activeworkbok.sheets
if sh.name < "Save Sheet" Then
sh.delete
end If
Next sh

Activeworkbook.Saveas Filename:="save.xls

Application.DisplaAlerts = True



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Saving only 1 sheet of a workbook

worksheets("Save Sheet").Copy ' copies to a new workbook
Activeworkbook.SaveAs "Save.xls"

--
Regards,
Tom Ogilvy

"Jay Wilson" wrote in message
...
How do I save only 1 sheet of a workbook into a new file

I tried
Worksheets("Save Sheet").Saveas Filename:="save.xls"

The above for some reason is saving all sheets and macros, not just the

one
I requested it save.

Thanks
---
Jay Wilson





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
Saving / emailing sinlge excel sheet, not entire workbook BRCorprado Excel Discussion (Misc queries) 2 September 17th 09 10:34 PM
Color Changes When Saving 2007 Workbook as 97 - 2003 Workbook Don Excel Discussion (Misc queries) 0 April 20th 08 04:51 AM
specify each sheet name when saving workbook as html [email protected] Excel Discussion (Misc queries) 3 May 7th 07 07:01 PM
Saving one sheet within a workbook David Vollmer Excel Discussion (Misc queries) 2 September 14th 05 06:04 PM
Weekly Email one sheet in workbook not saving contacts Brian Mashburn Excel Worksheet Functions 0 January 27th 05 07:19 PM


All times are GMT +1. The time now is 01:16 AM.

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

About Us

"It's about Microsoft Excel"