ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Saving One Sheet as One Workbook (https://www.excelbanter.com/excel-programming/394053-saving-one-sheet-one-workbook.html)

DaveM[_2_]

Saving One Sheet as One Workbook
 
Hi all

This macro saves all sheets in my workbook, what code do I need to save the
sheet as One workbook, save a workbook with just that one sheet in it.

Public Sub BobsSaveAs()
Const PATH As String = "c:\test\"
With ActiveWorkbook
..SaveAs Filename:=PATH & _
..Sheets("Test1").Range("G1").Value & ".xls"
End With
End Sub

Still learning

Thanks in advance

Dave



Anony

Saving One Sheet as One Workbook
 
Assuming I understood you correctly, you want the sheet "Test1" to be the
only sheet in a new workbook, and save that new workbook instead. Try this:

Sub SaveOneSheet()
Dim Sht As Worksheet
Const PATH As String = "C:\test\"

Set Sht = ActiveWorkbook.Sheets("Test1")
Sht.Select
Sht.Copy
ActiveWorkbook.SaveAs Filename:= _
PATH & Sht.Range("G1") & ".xls", FileFormat:=xlNormal
End Sub

--------
Cheers,
Anony


"DaveM" wrote:

Hi all

This macro saves all sheets in my workbook, what code do I need to save the
sheet as One workbook, save a workbook with just that one sheet in it.

Public Sub BobsSaveAs()
Const PATH As String = "c:\test\"
With ActiveWorkbook
..SaveAs Filename:=PATH & _
..Sheets("Test1").Range("G1").Value & ".xls"
End With
End Sub

Still learning

Thanks in advance

Dave




Gary Keramidas

Saving One Sheet as One Workbook
 
basically all you need is

Sub test()
Const fPATH As String = "c:\test\"
Worksheets("test1").Copy
ActiveWorkbook.SaveAs fPATH & Sheets("Test1").Range("G1").Value & ".xls"
End Sub


--


Gary


"DaveM" wrote in message
. uk...
Hi all

This macro saves all sheets in my workbook, what code do I need to save the
sheet as One workbook, save a workbook with just that one sheet in it.

Public Sub BobsSaveAs()
Const PATH As String = "c:\test\"
With ActiveWorkbook
.SaveAs Filename:=PATH & _
.Sheets("Test1").Range("G1").Value & ".xls"
End With
End Sub

Still learning

Thanks in advance

Dave




DaveM[_2_]

Saving One Sheet as One Workbook
 
Thanks guys, All the best

"Gary Keramidas" <GKeramidasATmsn.com wrote in message
...
basically all you need is

Sub test()
Const fPATH As String = "c:\test\"
Worksheets("test1").Copy
ActiveWorkbook.SaveAs fPATH & Sheets("Test1").Range("G1").Value & ".xls"
End Sub


--


Gary


"DaveM" wrote in message
. uk...
Hi all

This macro saves all sheets in my workbook, what code do I need to save
the sheet as One workbook, save a workbook with just that one sheet in
it.

Public Sub BobsSaveAs()
Const PATH As String = "c:\test\"
With ActiveWorkbook
.SaveAs Filename:=PATH & _
.Sheets("Test1").Range("G1").Value & ".xls"
End With
End Sub

Still learning

Thanks in advance

Dave







All times are GMT +1. The time now is 09:44 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com