ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Save ONLY 1 Sheet in a Shared Workbook (https://www.excelbanter.com/excel-programming/419696-save-only-1-sheet-shared-workbook.html)

[email protected]

Save ONLY 1 Sheet in a Shared Workbook
 
I have 3 sheets within my shared workbook: SheetAA, SheetBB, SheetCC
I ONLY want to allow the contents of "SheetCC" to save when the SAVE
button is clicked OR the sheet is closed.

How can I code this in VB, and where should codes be placed?

Dave Peterson

Save ONLY 1 Sheet in a Shared Workbook
 
When you save a workbook, you save all the sheets in that workbook.

So you want to delete the other sheets before the workbook is saved, right?

Well, the problem with that is that you can't delete sheets from a shared
workbook.

So maybe you could provide a macro that would:
unshare the workbook
delete the sheets
share the workbook
and then save this workbook.

You could record a macro when you do this manually and you'll have the code.



wrote:

I have 3 sheets within my shared workbook: SheetAA, SheetBB, SheetCC
I ONLY want to allow the contents of "SheetCC" to save when the SAVE
button is clicked OR the sheet is closed.

How can I code this in VB, and where should codes be placed?


--

Dave Peterson

JLGWhiz

Save ONLY 1 Sheet in a Shared Workbook
 
I believe it will allow you to clear contents of sheets AA and BB and then
you could save the entire workbook with only sheet CC containing data, but
then you lose any formulas you had in sheets AA and BB.

Or as Dave suggested, unshare the workbook, then do a worksheets("CC").Copy
without specifying the before or after and it creates a new workbook which
you can then do a saveas on, the reshare the original workbook. This could
all be done with code external to the shared workbook.

" wrote:

I have 3 sheets within my shared workbook: SheetAA, SheetBB, SheetCC
I ONLY want to allow the contents of "SheetCC" to save when the SAVE
button is clicked OR the sheet is closed.

How can I code this in VB, and where should codes be placed?



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

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