View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
ChasAA ChasAA is offline
external usenet poster
 
Posts: 33
Default Disable Menu Items Insert/Delete Entire Column(s)

You could have a custom menu.
Or you could temporarily disable the "Edit" and "Insert" menus from the menu
bar.
As far as I can remember you could be more specific and disable only some of
the sub menus of Edit and Insert.

If this will suit you, let me know and I'll try and look up one of my old
programs as to how I did it.

Chas

"JR_06062005" wrote:

I have a spreadsheet which has some macros associated with it and need to
make sure that columns are not deleted or inserted. For the case where the
context menu is used to delete or insert a columns, the following code works
because one has to select the entire column:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Rows.Count = 65536 Then
ActiveSheet.Protect
Else
ActiveSheet.Unprotect
End If
End Sub
(The above code places the spreadsheet in the protection mode if an
entire column is selected and unprotects it when a cell or range of cells is
selected.)

However, this does not work if someone decides to delete or insert using the
Excel menu. I don't want to keep the sheet in a protected mode since this is
too restrictive, but I do need a way to protect the columns. Any help with
this is appreciated.