Saving Worksheet to new file by tab name
Hi Bobzter:
This routine uses C:\temp
Change it to suit your needs:
Sub Macro1()
' gsnuxx
wbn = ActiveWorkbook.Name
shn = ActiveSheet.Name
Workbooks.Add
wbnew = ActiveWorkbook.Name
Windows(wbn).Activate
Sheets(shn).Copy Befo=Workbooks(wbnew).Sheets(1)
Windows(wbnew).Activate
Application.DisplayAlerts = False
For Each sh In Worksheets
If sh.Name < shn Then
sh.Delete
End If
Next
Application.DisplayAlerts = True
destin = "C:\temp\" & shn & ".xls"
ActiveWorkbook.SaveAs Filename:=destin
ActiveWorkbook.Close
End Sub
--
Gary''s Student - gsnu200755
"Bobzter100" wrote:
Hi
I need to save a single worksheet from a master workbook by its tab name to
a specific folder on my C: drive. The macro needs to extract the worksheet,
save it to the c: drive, close the new file and return me to the original
file (the master). Also €“can I remove the standard Sheet 1, Sheet 2 and Sheet
3 when creating the new file as they are not required.
I have already created the tab name and the folder on the c: drive
(C:\Report Logs)and only need the macro to accomplish the above.
Cheers
Bobzter
|