0

Excel has a feature where selected data can be moved if you hover over the edge of the data selection outline, then left click and drag. To be clear, I'm not talking about the feature where data can be expanded by dragging the slightly larger green square at the bottom right of a selection.

E.g. I can grab this green outline anywhere other than the lower right corner and drag these numbers elsewhere:

enter image description here

E.g. I can drag them down one row:

enter image description here

If I try to drag them onto existing data, there's a warning that they're going to replace existing data:

enter image description here

(Sorry, Windows Snip is not showing the mouse which would make this clearer)

The thing is, in ~20 years of very heavy Excel use I've never used this feature, and lately for some reason I find I'm frequently invoking it accidentally just from navigating around spreadsheets. I don't know if it's an issue with a more sensitive mouse button or something about the arrangement of quantity of data in my spreadsheets, but it's really annoying me. I'm having to cancel that confirmation multiple times a day.

My question is, is there any way to disable the drag to move data feature completely? So that the only thing you can do with that outline is expand the data.

Thanks.

1

1 Answer 1

0

Try the following macros (in a sheet module):

Dim sel As String
Dim stopundo As String
Dim tc As Double

Private Sub Worksheet_Change(ByVal Target As Range)
   Application.AlertBeforeOverwriting = False
   Application.EnableEvents = False
   If stopundo <> "N" Then
      tc = Target.CountLarge
      stopundo = "N"
   ElseIf Target.Address <> sel And Target.CountLarge = tc Then
      MsgBox "cannot drag-and-drop"
      stopundo = "Y"
      Application.Undo
   End If
   Application.EnableEvents = True
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
   If TypeName(Selection) = "Range" Then
      sel = Selection.Address
      tc = Selection.CountLarge
   End If
End Sub

If you want to Cut and Paste some cells you must select destination range larger or smaller than the source range.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .