Override protected sheet message?

R

Robert Crandal

My sheet is "protected". The user is only allowed to select
locked or unlocked cells. If a user tries to double click on any cell
or change data, Excel shows the following message box:

"The cell or chart that you are trying to change is protected and
therefore read-only."

Does anyone know if it's possible to override this default message
box? It would be nice if I could display my own custom message
box, or run my own subroutine if a user tries to change data on a
protected sheet. I doubt it's possible, but I just want to check if
anyone here knows how to do this??

Thank you!

Robert
 
G

GS

You can trap the user double-clicking cells in the
Worksheet_BeforeDoubleClick event. Here, you can display your own
message and cancel Excel's notification message (Cancel = True).

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion
 
G

GS

GS has brought this to us :
You can trap the user double-clicking cells in the
Worksheet_BeforeDoubleClick event. Here, you can display your own message and
cancel Excel's notification message (Cancel = True).

Note, however, that this approach doesn't trap if the user presses the
F2 key. Use Application.OnKey to enable/disable this shortcut while
your app is running...

At startup:
Application.OnKey "{F2}", "" '//disable
OR
Application.OnKey "{F2}", "TrapCellEditing" '//run your code

...and be sure to reset it at shutdown...

Application.OnKey "{F2}" '//reset to normal behavior

In your Worksheet_BeforeDoubleClick event you can redirect to the same
procedure...

Cancel = True: Call TrapCellEditing

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion
 
R

Robert Crandal

GS said:
You can trap the user double-clicking cells in the
Worksheet_BeforeDoubleClick event. Here, you can display your own
message and cancel Excel's notification message (Cancel = True).

Outstanding! Thanks again for your expertise Garry!
 

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