Data Validation List annoyance !!

Jaafar Tribak

Well-known Member
Joined
Dec 5, 2002
Messages
9,638
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

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
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,215,836
Messages
6,127,173
Members
449,368
Latest member
JayHo

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