ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Unable cut in workbook (https://www.excelbanter.com/excel-programming/293597-unable-cut-workbook.html)

Andre[_2_]

Unable cut in workbook
 
Please, can somebody help me write a macro to unable the cut function on a workbook
No matter how they try to cut, keyboard shorcut, edit menu, right-clicking on the cell(s), I would like to have this fuction unabled

Thanks in advance.

Greg Wilson[_4_]

Unable cut in workbook
 
Note that I disable the DragAndDrop feature which is
another form of cut and paste. However, this can be reset
by selecting this option through Tools|Options|Edit
tab|Allow cell drag and drop checkbox. Therefore, I
automatically disable it every time there is a selection
change.

Correct for wordwrap corruption and doubling of leading
periods if it occurs. Paste to the ThisWorkbook module:-

Dim DragAndDropStatus As Boolean
Private Sub Workbook_Open()
With Application
DragAndDropStatus = .CellDragAndDrop
..OnKey "^{x}", ""
..CellDragAndDrop = False
..CommandBars("Cell").Controls("Cut").Enabled = False
..CommandBars("Worksheet Menu Bar").Controls
("Edit").Controls("Cut").Enabled = False
End With
End Sub

Private Sub Workbook_Deactivate()
With Application
..CellDragAndDrop = DragAndDropStatus
..CommandBars("Cell").Controls("Cut").Enabled = True
..CommandBars("Worksheet Menu Bar").Controls
("Edit").Controls("Cut").Enabled = True
End With
End Sub

Private Sub Workbook_SheetSelectionChange(ByVal Sh As
Object, ByVal Target As Range)
Application.CellDragAndDrop = False
End Sub

Not rigorously tested. Never used by me so I can't attest
to the practicality.

Regards,
Greg


All times are GMT +1. The time now is 02:54 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com