G
Guest
Guest
I have a workbook with so many sheets in it. I want to save just one sheet of the workbook, I mean I do not want to save the entire workbook.
Thanks,
Ayhan KIZILTAN
Thanks,
Ayhan KIZILTAN
On 2002-02-21 08:17, RWinfield wrote:
Application.ScreenUpdating = False
ActiveSheet.Select
ActiveSheet.Copy
ActiveSheet.SaveAs Filename:="YOUR DIR" & YOUR FILENAME & ".xls"
Application.ScreenUpdating = True
Exit Sub
This will copy the active sheet to a new workbook with a single sheet then save it.
Rick
On 2002-02-21 12:05, Anonymous wrote:
This may seem silly, but why not simply use the Edit / Move or Copy Sheet feature? Tick the "Copy" box, put it in a new workbook and voila, one sheet saved.
Nanette
On 2002-02-21 09:08, RWinfield wrote:
Sub savesheet2()
Application.ScreenUpdating = False
ActiveSheet.Select
ActiveSheet.Copy
ThisFile = Range("A1").Value
ActiveSheet.SaveAs Filename:="C:temp" & ThisFile & ".xls"
Application.ScreenUpdating = True
ActiveWorkbook.Close
End Sub
To use this open the workbook that you want to use this code in, then open the Visual Basic editor (press alt+F11). Once there click the INSERT menu item and choose MODULE from that menu. Copy the above code into the window. You need to make two changes to the above code.
ThisFile = Range("A1").Value...change A1 to an unused cell on your worksheet. This is the cell where you will enter the file name that you want the sheet saved as.
ActiveSheet.SaveAs Filename:="C:temp" ... change to the directory you want the file saved to.
Once you have done this close the VB editor and the macro will appear under TOOLSMACROS menu on the workbook. If you want the macro to be called something other than savesheet2 then edit the name prior to closing the VB editor.
Enter a file name in the cell you chose and run the macro. The macro will copy the active sheet to a new workbook with one sheet, then save the workbook as the filename you input, then will close the new workbook, which returns you to the original workbook with multiple sheets that you were working on.
Hope this make some sense
Rick