Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
saving a sheet in a new workbook | Excel Programming | |||
Saving a sheet in a workbook as .csv but not changing workbook name | Excel Programming | |||
Saving one sheet within a workbook | Excel Discussion (Misc queries) | |||
saving sheet as new workbook | Excel Programming | |||
Saving only 1 sheet of a workbook | Excel Programming |