Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Macro not allowing inserting cells/colums/rows

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Allowing Delete Table Rows at a Cells Protected Worksheet Rob2204 Excel Discussion (Misc queries) 0 January 19th 10 05:31 PM
Macro to hide rows/colums by value [email protected] Excel Programming 7 September 14th 06 02:45 PM
Stop rows from being deleted whilst allowing cells contents to cha SueD Excel Discussion (Misc queries) 2 August 22nd 06 02:59 PM
macro total for colums with changing # of rows BillyRogers Excel Programming 5 January 26th 06 08:58 PM
Macro & Command Key to change data from Colums to rows Danno[_5_] Excel Programming 3 June 10th 04 02:53 PM


All times are GMT +1. The time now is 03:52 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"