View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default Saving one specific worksheet in a workbook

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/