Message if Shared Workbook is deselected

Pauljj

Well-known Member
Joined
Mar 28, 2004
Messages
2,011
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 ?
 

Some videos you may like

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

BrianB

Well-known Member
Joined
Feb 17, 2003
Messages
8,127
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
 

Pauljj

Well-known Member
Joined
Mar 28, 2004
Messages
2,011
Ive inserted a module and copied this code across but nothing happens when I deselect the box ?
 

Pauljj

Well-known Member
Joined
Mar 28, 2004
Messages
2,011
Any ideas how I can get this code to work please ??


Thanks

Paul
 

BrianB

Well-known Member
Joined
Feb 17, 2003
Messages
8,127
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.
 

Watch MrExcel Video

Forum statistics

Threads
1,118,020
Messages
5,569,671
Members
412,286
Latest member
kychemist00
Top