Hi,

I want the following code to be loaded automaticly when i open an excel file to prevent cells to be drag and dropped.
Private Sub Workbook_Open()
       With Application
        .CellDragAndDrop = False
        EnableControl 21, False   ' cut
        EnableControl 19, False   ' copy
        EnableControl 22, False   ' paste
        EnableControl 755, False  ' pastespecial
        Application.OnKey "^c", "Dummy"
        Application.OnKey "^v", "Dummy"
        Application.OnKey "+{DEL}", "Dummy"
        Application.OnKey "+{INSERT}", "Dummy"
        Application.CellDragAndDrop = False
        .CommandBars("ToolBar List").Enabled = False
 
     End With

End Sub


 Private Sub Workbook_BeforeClose(Cancel As Boolean)


   With Application
    
    .CellDragAndDrop = True
    EnableControl 21, True   ' cut
    EnableControl 19, True   ' copy
    EnableControl 22, True   ' paste
    EnableControl 755, True  ' pastespecial
    Application.OnKey "^c"
    Application.OnKey "^v"
    Application.OnKey "+{DEL}"
    Application.OnKey "+{INSERT}"
    Application.CellDragAndDrop = True
    .CommandBars("ToolBar List").Enabled = True
 
   End With


  End Sub
I have tried this with a clean sheet, but after closing and opening the file i could still "drag and drop" cells around.

Anyone who can point me in the right direction?

With best regards,

Dinus.

DragAndDropTest.xlsm