disable cell "drag and drop" for a cell/range meeting given condit

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Dear experts,
is there a way I can disable the cell drag and drop only for a certain range
meeting my requirements? I am now using "Application.CellDragAndDrop = False"
which disables the application for every cell... which is quite annoying for
my users.
Many thanks in advance,
best regards,
 
You can code it in worksheet selection_change event procedure.

Find out if the selected range (Target) is within your range for which you
want dragdrop to be disabled,
with Intersect method. If it intersects set CellDragAnd Drop to False, else
Set it to True

e.g.:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim myRange As Range
Set myRange = Worksheets("Sheet1").Range("A5:E10")
'In above statement set your range for which you want no drag drop
If Application.Intersect(Target, myRange) Is Nothing Then
Application.CellDragAndDrop = True
Else
Application.CellDragAndDrop = False
End If
End Sub
 
Back
Top