ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   save active sheet (https://www.excelbanter.com/excel-programming/329518-save-active-sheet.html)

VilMarci

save active sheet
 
Hi,

How can I save only the active sheet of a workbook in VBA?

Marci



William[_2_]

save active sheet
 

Sub test()
ActiveSheet.Copy
ActiveWorkbook.SaveAs Filename:="C:\MyFolder\MySubFolder\Test.xls"
ActiveWorkbook.Close
End Sub

What did you want to happen to the original workbook?
--


XL2003
Regards

William



"VilMarci" wrote in message
...
Hi,

How can I save only the active sheet of a workbook in VBA?

Marci





VilMarci

save active sheet
 
Hi,

Thanks for the quick reply.
The main task would be to separate the workbook into separate files per
sheet.

Marton


"William" wrote in message
...

Sub test()
ActiveSheet.Copy
ActiveWorkbook.SaveAs Filename:="C:\MyFolder\MySubFolder\Test.xls"
ActiveWorkbook.Close
End Sub

What did you want to happen to the original workbook?
--


XL2003
Regards

William



"VilMarci" wrote in message
...
Hi,

How can I save only the active sheet of a workbook in VBA?

Marci







Andibevan[_2_]

save active sheet
 
Hi,

The code provided will do that - the activesheet.copy command is not like
copy and paste. It creates a copy of the active sheet, in a new workbook.
The new workbook is then saved, thus saving your sheet.

Andi

"VilMarci" wrote in message
...
Hi,

Thanks for the quick reply.
The main task would be to separate the workbook into separate files per
sheet.

Marton


"William" wrote in message
...

Sub test()
ActiveSheet.Copy
ActiveWorkbook.SaveAs Filename:="C:\MyFolder\MySubFolder\Test.xls"
ActiveWorkbook.Close
End Sub

What did you want to happen to the original workbook?
--


XL2003
Regards

William



"VilMarci" wrote in message
...
Hi,

How can I save only the active sheet of a workbook in VBA?

Marci








Tom Ogilvy

save active sheet
 
Sub test()
Dim sh as Worksheet
for each sh in Worksheets
sh.Copy
Application.displayAlerts = False
ActiveWorkbook.SaveAs Filename:="C:\MyFolder\MySubFolder\" & _
sh.Name & ".xls"
Application.displayAlerts = True
ActiveWorkbook.Close Savechanges:=False
Next
End Sub

--
Regards,
Tom Ogilvy

"VilMarci" wrote in message
...
Hi,

Thanks for the quick reply.
The main task would be to separate the workbook into separate files per
sheet.

Marton


"William" wrote in message
...

Sub test()
ActiveSheet.Copy
ActiveWorkbook.SaveAs Filename:="C:\MyFolder\MySubFolder\Test.xls"
ActiveWorkbook.Close
End Sub

What did you want to happen to the original workbook?
--


XL2003
Regards

William



"VilMarci" wrote in message
...
Hi,

How can I save only the active sheet of a workbook in VBA?

Marci









VilMarci

save active sheet
 
Thanks for you all!

This .copy I didn't know.

I have a lot of linked cells. Is it possible to use and save the current
static values, so the persons who receives the standalone sheets will have
all the data they need?

Marton

"Tom Ogilvy" wrote in message
...
Sub test()
Dim sh as Worksheet
for each sh in Worksheets
sh.Copy
Application.displayAlerts = False
ActiveWorkbook.SaveAs Filename:="C:\MyFolder\MySubFolder\" & _
sh.Name & ".xls"
Application.displayAlerts = True
ActiveWorkbook.Close Savechanges:=False
Next
End Sub

--
Regards,
Tom Ogilvy

"VilMarci" wrote in message
...
Hi,

Thanks for the quick reply.
The main task would be to separate the workbook into separate files per
sheet.

Marton


"William" wrote in message
...

Sub test()
ActiveSheet.Copy
ActiveWorkbook.SaveAs Filename:="C:\MyFolder\MySubFolder\Test.xls"
ActiveWorkbook.Close
End Sub

What did you want to happen to the original workbook?
--


XL2003
Regards

William



"VilMarci" wrote in message
...
Hi,

How can I save only the active sheet of a workbook in VBA?

Marci











VilMarci

save active sheet
 
Solved.

Thank you all again!

Marton

"VilMarci" wrote in message
...
Thanks for you all!

This .copy I didn't know.

I have a lot of linked cells. Is it possible to use and save the current
static values, so the persons who receives the standalone sheets will have
all the data they need?

Marton

"Tom Ogilvy" wrote in message
...
Sub test()
Dim sh as Worksheet
for each sh in Worksheets
sh.Copy
Application.displayAlerts = False
ActiveWorkbook.SaveAs Filename:="C:\MyFolder\MySubFolder\" & _
sh.Name & ".xls"
Application.displayAlerts = True
ActiveWorkbook.Close Savechanges:=False
Next
End Sub

--
Regards,
Tom Ogilvy

"VilMarci" wrote in message
...
Hi,

Thanks for the quick reply.
The main task would be to separate the workbook into separate files

per
sheet.

Marton


"William" wrote in message
...

Sub test()
ActiveSheet.Copy
ActiveWorkbook.SaveAs Filename:="C:\MyFolder\MySubFolder\Test.xls"
ActiveWorkbook.Close
End Sub

What did you want to happen to the original workbook?
--


XL2003
Regards

William



"VilMarci" wrote in message
...
Hi,

How can I save only the active sheet of a workbook in VBA?

Marci














All times are GMT +1. The time now is 12:12 PM.

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