Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a workbook which has several worksheets.
How do I save just one particular worksheet, including the formatting, using VBA code. The worksheet does have references to other worksheets, within the workbook ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~ View and post usenet messages directly from http://www.ExcelForum.com/ |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
A worksheet must be contained in a workbook, so you need to copy the sheet
to a new workbook and then save that new workbook. E.g., Worksheets("Sheet2").Copy ActiveWorkbook.SaveAs Filename:="C:\test.xls" ActiveWorkbook.Close False This will create a new workbook containing only Sheet2 from the original workbook, and then save it as C:\Test.xls and close it. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "budenba" wrote in message ... I have a workbook which has several worksheets. How do I save just one particular worksheet, including the formatting, using VBA code. The worksheet does have references to other worksheets, within the workbook ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~ View and post usenet messages directly from http://www.ExcelForum.com/ |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
worksheets("Sheet9").copy ' creates new single sheet workbook
ActiveWorkbook.SaveAs "C:\My Folder\Myfile.xls" ActiveWorkbook.Close SaveChanges:=False so what do you want to happen to the linked cells - as written, they remain and this workbook has a link back to the original. worksheets("Sheet9").copy ActiveSheet.Cells.Copy ' creates new single sheet workbook Activesheet.Cells.Pastespecial xlValues ActiveWorkbook.SaveAs "C:\My Folder\Myfile.xls" ActiveWorkbook.Close SaveChanges:=False the above replaces all formulas with the value they display - no formulas, no links. -- Regards, Tom Ogilvy "budenba" wrote in message ... I have a workbook which has several worksheets. How do I save just one particular worksheet, including the formatting, using VBA code. The worksheet does have references to other worksheets, within the workbook ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~ View and post usenet messages directly from http://www.ExcelForum.com/ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Saving a Worksheet/Workbook with VALUES ONLY | Excel Discussion (Misc queries) | |||
Copy Data from Workbook into specific Worksheet in other Workbook? | Excel Discussion (Misc queries) | |||
Saving into 1 workbook as a different worksheet | Excel Worksheet Functions | |||
Saving data in a worksheet within a workbook | Excel Discussion (Misc queries) | |||
When saving workbook only the first worksheet gets saved. | Excel Worksheet Functions |