Prevent user from deleting data

ElvisSteel

Board Regular
Joined
Mar 23, 2009
Messages
122
Hi,

Cells C3:C32 have data validation for a dropdown list.
I need to prevent the user from deleting any entries in this column.
The "Ignore Blanks" checkbox doesn't appear to have any effect, so I am using the following code...
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
 If Not Intersect(Target, Range("C3:C32")) Is Nothing Then
  If Target = "" Then
   Range("C" & Target.Row).Value = PrevCust
  End If
 End If
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
 If Application.CutCopyMode = xlCut Then Application.CutCopyMode = False
 PrevCust = Range("C" & Target.Row).Value
End Sub
This works fine when they try to delet a single cell, but I want to stop them selecting multiple cells in this range and then deleting them.
I assume I must test for Target > 1 and then do something but I'm not sure what.
Can anyone help please
Thanks (again)
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.

Forum statistics

Threads
1,214,981
Messages
6,122,566
Members
449,089
Latest member
Motoracer88

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