Data Validation List annoyance !!

Jaafar Tribak

Well-known Member
Joined
Dec 5, 2002
Messages
9,797
Office Version
  1. 2016
Platform
  1. Windows
Hi dear forum members,

I have the following scenario:

1- Add data validation list to cell A1.
2- Unlock the DV cell (A1) and Protect the worksheet.
3- I have the following code that displays a Msgbox upon double clicking the DV cell (A1):
Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
    If Target.Address = Range("A1").Address Then
        Cancel = True
        MsgBox "hello"
    End If
End Sub

PROBLEM:

if the worksheet is protected with the Edit Objects option CheckBox left unticked then the Msgbox never gets a chance to be displayed.

I have to make sure that I tick the Edit Objects in order for the MsgBox to be displayed.

The problem I am facing now is that if I tick the Edit Objects option when protecting the worksheet then all other objects, shapes etc that I have on the worksheet can be moved, resized, deleted by the user which I obviously want to avoid at all cost.

Can anybody think of a work around this problem ?

Using Excel 2016.

Thank You.
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
is it possible to refer to the object by its name, so if a user selects one that isn't usable the cursor is moved away ? just a thought
 
Upvote 0
Thanks Fazza and mole999.

I really must us the DBlClick event to bring up the MsgBox :(

As for preventing the selection of shapes , I had thought about something along those lines but the main issue is that there is no native event that fires when a shape is being selected.

I can think of a couple of vba tacky workarounds in order to fire an event when a shape is selected but it is flaky at best.

I just hoped there would be a more stable fix.
 
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,193
Members
452,616
Latest member
intern444

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