View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Rob Bovey Rob Bovey is offline
external usenet poster
 
Posts: 811
Default Looking to save one sheet in a workbook of two sheets...

Hi Jim,

I'm assuming you understand that the best you can do is save a workbook
that contains only a single worksheet. There's no concept of saving a
worksheet object outside a workbook in modern versions of Excel. Given that,
the easiest way to get what you want is to copy the sheet that you want to
save out to a new workbook, then save that workbook. It can be as simple as
the following three lines of code depending on your situation:

Sheet1.Copy
ActiveWorkbook.SaveAs "E:\MySheet.xls"
ActiveWorkbook.Close False

--
Rob Bovey, MCSE, MCSD, Excel MVP
Application Professionals
http://www.appspro.com/

* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *


"Jim Carlock" wrote in message
...
I'm looking for a way to save one worksheet out of a workbook
of two sheets... I don't want the VB modules saved, nor any VB
code, forms, etc.

The Worksheet.SaveAs command doesn't seem to work even
though the help file indicates that it's to save a worksheet (and
I'm strictly keeping a worksheet defined as 1 and only 1
worksheet - rather than the whole work book).

I've thought about creating the worksheet as a seperate file but
before I continue in that direction, I'll ask here.

I've either missed something completely, and saving one and only
one worksheet out of a workbook is a little more complicated
than I've realized.

I'm leaning into seperating the code sheet from the data sheet
right at the moment.

Any advice is appreciated. Thank you.

--
Jim Carlock
http://www.microcosmotalk.com
Feel free to post back to the newsgroup!