Save ONLY 1 Sheet in a Shared Workbook

T

truapplegirl

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?
 
D

Dave Peterson

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.
 
J

JLGWhiz

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top