Saving One Sheet as One Workbook

D

DaveM

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
 
G

Guest

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
 
G

Gary Keramidas

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
 
D

DaveM

Thanks guys, All the best

Gary Keramidas said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top