Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default save active sheet

Hi,

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

Marci


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 227
Default 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




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default 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






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 128
Default 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







  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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










  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default 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










  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default 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












Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
save only active sheet Button. tim Excel Discussion (Misc queries) 7 May 23rd 08 11:27 PM
How to save a workbook to an active Web Page? Nadia Excel Discussion (Misc queries) 0 May 2nd 08 06:23 PM
Date each active tab upon save Ken King Excel Discussion (Misc queries) 3 October 31st 06 01:13 AM
Active Cell Copy And Paste Sheet to Sheet A.R.J Allan Jefferys New Users to Excel 4 May 4th 06 02:04 AM
Save active worksheet to CSV file Scott Excel Programming 3 September 24th 03 04:51 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"