Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 77
Default Save just a worksheet from a workbook

Is it possible to save just a worksheet out of a workbook that is quite large?

Example: I have a user form that extracts data from a worksheet labeled
'data', and with a command button inputs the data into another worksheet
labeled 'form' in the same workbook. The userform also allows the user to
change the information on the user form if it is incorrect, and then with the
command button populate the appropriate fields on the form (worksheet
formatted to look like a commonly used form).

Since the workbook's size is upwards of 1 meg, and each applicant would have
to be saved, I thought the best way would be to save just the form with the
data put into it. I have tried several different ways via this website and
others, but I am a novice vba user.

Please help! Thankyou.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default Save just a worksheet from a workbook

Maybe when the user clicks a command button to save (or in the
Workbook_BeforeClose event) you can delete all the other sheets and save the
workbook with a new name.

Dim Sheet As Worksheet

For Each Sheet In ActiveWorkbook
If Sheet.Name < "Form" Then Sheet.Delete
Next Sheet

ActiveWorkbook.SaveAs "C:\NewWorkbook.xls"


"BigPig" wrote:

Is it possible to save just a worksheet out of a workbook that is quite large?

Example: I have a user form that extracts data from a worksheet labeled
'data', and with a command button inputs the data into another worksheet
labeled 'form' in the same workbook. The userform also allows the user to
change the information on the user form if it is incorrect, and then with the
command button populate the appropriate fields on the form (worksheet
formatted to look like a commonly used form).

Since the workbook's size is upwards of 1 meg, and each applicant would have
to be saved, I thought the best way would be to save just the form with the
data put into it. I have tried several different ways via this website and
others, but I am a novice vba user.

Please help! Thankyou.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Save just a worksheet from a workbook

activesheet.copy ' creates a new one page workbook
' with a copy of the activesheet in it
' this becomes the activesheet/book
Activeworkbook.SaveAS "C:\MyFolder\" & activesheet.name & ".xls"
Activeworkbook.Close SaveChanges:=False

--
Regards,
Tom Ogilvy


"BigPig" wrote in message
...
Is it possible to save just a worksheet out of a workbook that is quite

large?

Example: I have a user form that extracts data from a worksheet labeled
'data', and with a command button inputs the data into another worksheet
labeled 'form' in the same workbook. The userform also allows the user to
change the information on the user form if it is incorrect, and then with

the
command button populate the appropriate fields on the form (worksheet
formatted to look like a commonly used form).

Since the workbook's size is upwards of 1 meg, and each applicant would

have
to be saved, I thought the best way would be to save just the form with

the
data put into it. I have tried several different ways via this website and
others, but I am a novice vba user.

Please help! Thankyou.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 77
Default Save just a worksheet from a workbook

Thanks so much for your input!

It definitely helped. I do have to admit that after trying your suggestion,
I tried Tom's. Tom's was more of what I was looking for. Nonetheless, your
help is greatly appreciated. Thankyou!
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 77
Default Save just a worksheet from a workbook

Tom,

Thankyou very much for your suggestion. It worked perfectly and then some!

If it wasn't for Excel Newsgroups and the people, like yourself that provide
help, I don't know what I'd do.

Thankyou again!


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 516
Default Save just a worksheet from a workbook

Hi Tom. Ran across this thread today and your code was helpful to me as well.
I have a question. Using similar code, could I do the following:

I have a workbook with a seperate sheet for each employee. Our admin updates
their sales leads every day with entries on their sheets. I would like to use
a command button with your code. She could finish the entry on the master,
click to use your code to save their sheet as a seperate workbook in the same
folder. Then the salesperson could update their own sheet and use a command
button to then update their sheet in the master.

Problem is that the info would have to append and not overwrite so this
maybe impossible. Thank you for any help you can provide.

"Tom Ogilvy" wrote:

activesheet.copy ' creates a new one page workbook
' with a copy of the activesheet in it
' this becomes the activesheet/book
Activeworkbook.SaveAS "C:\MyFolder\" & activesheet.name & ".xls"
Activeworkbook.Close SaveChanges:=False

--
Regards,
Tom Ogilvy


"BigPig" wrote in message
...
Is it possible to save just a worksheet out of a workbook that is quite

large?

Example: I have a user form that extracts data from a worksheet labeled
'data', and with a command button inputs the data into another worksheet
labeled 'form' in the same workbook. The userform also allows the user to
change the information on the user form if it is incorrect, and then with

the
command button populate the appropriate fields on the form (worksheet
formatted to look like a commonly used form).

Since the workbook's size is upwards of 1 meg, and each applicant would

have
to be saved, I thought the best way would be to save just the form with

the
data put into it. I have tried several different ways via this website and
others, but I am a novice vba user.

Please help! Thankyou.




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
How do I save a worksheet within a workbook? jester Excel Discussion (Misc queries) 1 August 7th 06 10:54 PM
Save Worksheet vs Workbook Terry Excel Worksheet Functions 1 January 6th 06 05:31 PM
Save Every Worksheet as its own Workbook Michael Smith Excel Programming 11 February 25th 05 04:22 PM
Save Workbook or worksheet Hugh Excel Programming 3 October 22nd 04 02:01 PM
save worksheet as new workbook dreamer[_12_] Excel Programming 6 February 19th 04 02:56 PM


All times are GMT +1. The time now is 03:47 AM.

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

About Us

"It's about Microsoft Excel"