From: Garreth Lombard on 7 Apr 2010 06:40 Hi there wlam, Paste this code in the "ThisWorkbook" VBA code module of the workbook you want to protect. Code is below. ----------------------- Const DisableCutOperations As Boolean = True Private Sub Workbook_WindowActivate(ByVal Wn As Excel.Window) If DisableCutOperations = False Then Exit Sub Set CutButton = Application.CommandBars("Worksheet Menu Bar"). _ Controls("edit").CommandBar.Controls("Cut") CutButton.OnAction = "ThisWorkbook.DisableCut" End Sub Private Sub Workbook_WindowDeactivate(ByVal Wn As Excel.Window) Set CutButton = Application.CommandBars("Worksheet Menu Bar"). _ Controls("edit").CommandBar.Controls("Cut") CutButton.OnAction = Cut End Sub Sub DisableCut() If DisableCutOperations = False Then Exit Sub If ActiveWorkbook.Name = ThisWorkbook.Name Then dummy = MsgBox("Do NOT use the cut function in this Workbook please. ", _ vbInformation, ActiveWorkbook.Name) Exit Sub Else: Selection.Cut End If End Sub ----------------------- I hope this code works for you -- Thank you and Regards Garreth Lombard "wlam" wrote: > Does any one know how to disable "cut" function in a protected worksheet? By > allowing cutting in unprotected cell, it is messing up the formula that I put > in the protected cell which is related to that unprotected cell.
|
Pages: 1 Prev: How to convert 115:14 into hours? ( 115 stands for hrs, 14 is Next: Using Worksheet Name |