ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   protect sheets against cutting / pasting (https://www.excelbanter.com/excel-worksheet-functions/92425-protect-sheets-against-cutting-pasting.html)

UllidIreland

protect sheets against cutting / pasting
 
(possibly as an option when protecting sheets)
cells can be protected within a worksheet but this does not prevent novice
users from cutting (sometimes accidentally by clicking/dragging) and pasting
to other unprotected areas, which may materially affect the integrity of the
spreadsheet



----------------
This post is a suggestion for Microsoft, and Microsoft responds to the
suggestions with the most votes. To vote for this suggestion, click the "I
Agree" button in the message pane. If you do not see the button, follow this
link to open the suggestion in the Microsoft Web-based Newsreader and then
click "I Agree" in the message pane.

http://www.microsoft.com/office/comm...et.f unctions

Bearacade

protect sheets against cutting / pasting
 

I got this from OzGrid,

Put this in ThisWorkbook

Private Sub Workbook_Activate()
Dim oCtrl As Office.CommandBarControl

'Disable all Cut menus
For Each oCtrl In Application.CommandBars.FindControls(ID:=21)
oCtrl.Enabled = False
Next oCtrl

'Disable all Copy menus
For Each oCtrl In Application.CommandBars.FindControls(ID:=19)
oCtrl.Enabled = False
Next oCtrl

Application.CellDragAndDrop = False

End Sub



Private Sub Workbook_Deactivate()
Dim oCtrl As Office.CommandBarControl

'Enable all Cut menus
For Each oCtrl In Application.CommandBars.FindControls(ID:=21)
oCtrl.Enabled = True
Next oCtrl

'Enable all Copy menus
For Each oCtrl In Application.CommandBars.FindControls(ID:=19)
oCtrl.Enabled = True
Next oCtrl

Application.CellDragAndDrop = True

End Sub

Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal
Target As Range)
With Application
.CellDragAndDrop = False
.CutCopyMode = False 'Clear clipboard
End With
End Sub


--
Bearacade


------------------------------------------------------------------------
Bearacade's Profile: http://www.excelforum.com/member.php...o&userid=35016
View this thread: http://www.excelforum.com/showthread...hreadid=549011



All times are GMT +1. The time now is 01:13 PM.

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