I found this code on the forum which prevents the user from pasting into a cell which contains a Data Validation List:
The problem I have is that with this enabled, whilst it successfully prevents the user from pasting into the cell, it also prevents the user from selecting an option from the drop down list (created using Data Validation and the List Option). Is there any way to adapt the code to achieve the same thing but still allow the user to select an option from the data validation drop down list?
Many thanks
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Select Case Target.Column
Case 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41
ActiveSheet.Unprotect 'only if your sheet is protected
If Selection.SpecialCells(xlCellTypeAllValidation).Count <> Selection.Cells.Count Then
Application.EnableEvents = False
Application.Undo
Application.EnableEvents = True
MsgBox ("The operation you just performed would have erased Data Validation, therefore it was cancelled")
Else
End If
' ActiveSheet.Protect 'only if you want protect your sheet
End Select
End Sub
Many thanks