ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Restore "Delete..." and "Insert..." shortcuts (https://www.excelbanter.com/excel-programming/404562-restore-delete-insert-shortcuts.html)

MarkB

Restore "Delete..." and "Insert..." shortcuts
 
Hello,

I am using this code to disable insertion and deletion of rows/columns:

Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As
Boolean)
Dim cBut As CommandBarControl
Dim iPostion As Integer
On Error Resume Next

Application.CommandBars("Cell").Controls("CLEAR ALL").Delete
With Application.CommandBars("Cell")
iPostion = .Controls("Delete...").Index
Set cBut = .Controls.Add(Befo=iPostion, Temporary:=True)
.Controls("Delete...").Delete
.Controls("insert...").Delete
With cBut
.Caption = "CLEAR ALL"
.OnAction = "ClearAll"
End With
End With
On Error GoTo 0


End Sub

I need to restore these to the shortcut menu when the application closes. I
can not seem to get the syntax right.

Please help?

Thanks,
--
Markb


All times are GMT +1. The time now is 03:27 PM.

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