Message if Shared Workbook is deselected

Pauljj

Well-known Member
Joined
Mar 28, 2004
Messages
2,047
I have a spreadsheet which is a Shared workbook. As this tracks the history of what happens to the spreasheet, If someone tries to deselect it I want a message to appear to with a YES and NO option button, so if they have not copied the history data the shared workbook remains, if they have copied the data and then click yes the shared workbook then becomes unticked and therfore exclusive...any ideas ?
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Something like this ? Copy/paste code to worksheet module (rightclick tab/View code)
Code:
Private Sub Worksheet_Deactivate()
   rsp = MsgBox("Deactivated. Save changes ?", vbYesNoCancel)
   If rsp = vbCancel Then Exit Sub
   If rsp = vbYes Then
        'do something
   Else
        ' do something else
   End If
End Sub
 
Upvote 0
Ive inserted a module and copied this code across but nothing happens when I deselect the box ?
 
Upvote 0
The code does not do anything as it stands - except it runs when the someone moves away from the sheet it is contained in to another one. There is a similar possibility for the workbook. It is necessary to replace "'do something " and "'do something else" with appropriate code.

Apart from that I do not know codewise what you are trying to achieve. A way forward would be to record macros of the 2 possibilities and come back with any problems.
 
Upvote 0

Forum statistics

Threads
1,214,773
Messages
6,121,479
Members
449,034
Latest member
Raygers

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top