Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Claudio,
Add a standard module and class module to the WB, then add the code below. Adjust the menu IDs for the actions you wish to monitor/control. Obviously macro and events must both be .Enabled for this to work. < ThisWork module Private Sub Workbook_Open() Set gclsCbarEvents = New CCbarEvents End Sub </ ThisWork module < Standard module Public gclsCbarEvents As CCbarEvents </ Standard module < Class module Private WithEvents mRowDelButton As CommandBarButton Private WithEvents mCellDelButton As CommandBarButton Private Sub Class_Initialize() Set mRowDelButton = Application.CommandBars.FindControl(, 293) Set mCellDelButton = Application.CommandBars.FindControl(, 478) End Sub Private Sub mCellDelButton_Click(ByVal Ctrl As Office.CommandBarButton, CancelDefault As Boolean) If TypeName(Selection) = "Range" Then If Selection.Address = Selection.EntireRow.Address Then MsgBox Selection.Rows.Count & " Row" & _ IIf(Selection.Rows.Count = 1, "", "s") & " deleted." End If End If End Sub Private Sub mRowDelButton_Click(ByVal Ctrl As Office.CommandBarButton, CancelDefault As Boolean) MsgBox Selection.Rows.Count & " Row" & _ IIf(Selection.Rows.Count = 1, "", "s") & " deleted." End Sub </ Class module NickHK "claudio" wrote in message ... Hi all, I need a macro that brings up a message if the user inserts a cell/column/row into the sheet (some users crack the password of the protection, and I want them to be reminded not to change the sheet). I have an ugly solution working with values in a column, added up and checked, but I'm sure there is a direct solution in VBA. I would appreciate help. Thanx Claudio |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Allowing Delete Table Rows at a Cells Protected Worksheet | Excel Discussion (Misc queries) | |||
Macro to hide rows/colums by value | Excel Programming | |||
Stop rows from being deleted whilst allowing cells contents to cha | Excel Discussion (Misc queries) | |||
macro total for colums with changing # of rows | Excel Programming | |||
Macro & Command Key to change data from Colums to rows | Excel Programming |