Save single worksheet?

  • Thread starter Thread starter Mat
  • Start date Start date
M

Mat

I've got a workbook containing multiple sheets, one of
which is a Invoice. I want the user to be able to press a
button, and for it to save the Invoice sheet only. I hit
the problem on the saving part. I can get it to save the
whole workbook, but not the single sheet.

How could I do this in VBA?
Thanks,
Mat,
(e-mail address removed)
 
Try this Mat

Sub test()
Sheets("Invoice").Copy
ActiveWorkbook.SaveAs "c:\data\Invoice " & Format(Now, "dd-mm-yy h-mm-ss")
ActiveWorkbook.Close
End Sub
 
Mat,

You can only save a workbook, so you would need to move the worksheet to a
new workbook and then save that, something like

Worksheets("Sheet1").Copy
ActiveWorkbook.SaveAs Filename:= "myfile.xls"


--

HTH

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