Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default Protecting validation

I have created data validations sheet and want to protect from getting
spoiled through cut, paste, clear, etc. I have written following code but
disabling the "Clear - All" and "Clear - Formats" is not working. Can
somebody please help.

Private Sub Worksheet_Activate()
Dim eCtrl As CommandBarControl
On Error Resume Next
For Each eCtrl In Application.CommandBars
eCtrl.FindControls(ID:=21).Enabled = 0 'Disable Ctrl-x
eCtrl.FindControls(ID:=1964).Enabled = 0 'Disable Clear - All
eCtrl.FindControls(ID:=872).Enabled = 0 'Disable Clear - Formats
Next eCtrl
With Application
If .CutCopyMode = xlCut Then .CutCopyMode = False
.OnKey "^x", ""
.CellDragAndDrop = False
.CopyObjectsWithCells = False
End With
End Sub

--
Thanx & regards,
Asif
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Protecting validation

Why not use the selection change event. It the TARGET has data validation

application.CutCopyMode = False

--
regards,
Tom Ogilvy


"Asif" wrote:

I have created data validations sheet and want to protect from getting
spoiled through cut, paste, clear, etc. I have written following code but
disabling the "Clear - All" and "Clear - Formats" is not working. Can
somebody please help.

Private Sub Worksheet_Activate()
Dim eCtrl As CommandBarControl
On Error Resume Next
For Each eCtrl In Application.CommandBars
eCtrl.FindControls(ID:=21).Enabled = 0 'Disable Ctrl-x
eCtrl.FindControls(ID:=1964).Enabled = 0 'Disable Clear - All
eCtrl.FindControls(ID:=872).Enabled = 0 'Disable Clear - Formats
Next eCtrl
With Application
If .CutCopyMode = xlCut Then .CutCopyMode = False
.OnKey "^x", ""
.CellDragAndDrop = False
.CopyObjectsWithCells = False
End With
End Sub

--
Thanx & regards,
Asif

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default Protecting validation

Hi Tom,

Thank you for your response. I want to disable these editings for a
particular worksheet only and re-enable it when the worksheet is de-activate.
In addition, if I have to use changeselection event, then I will have to name
many ranges as well.

--
Thanx & regards,
Asif


"Tom Ogilvy" wrote:

Why not use the selection change event. It the TARGET has data validation

application.CutCopyMode = False

--
regards,
Tom Ogilvy


"Asif" wrote:

I have created data validations sheet and want to protect from getting
spoiled through cut, paste, clear, etc. I have written following code but
disabling the "Clear - All" and "Clear - Formats" is not working. Can
somebody please help.

Private Sub Worksheet_Activate()
Dim eCtrl As CommandBarControl
On Error Resume Next
For Each eCtrl In Application.CommandBars
eCtrl.FindControls(ID:=21).Enabled = 0 'Disable Ctrl-x
eCtrl.FindControls(ID:=1964).Enabled = 0 'Disable Clear - All
eCtrl.FindControls(ID:=872).Enabled = 0 'Disable Clear - Formats
Next eCtrl
With Application
If .CutCopyMode = xlCut Then .CutCopyMode = False
.OnKey "^x", ""
.CellDragAndDrop = False
.CopyObjectsWithCells = False
End With
End Sub

--
Thanx & regards,
Asif

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
protecting formulas without protecting sheet so grouping still wor JM Excel Discussion (Misc queries) 1 June 4th 09 06:42 AM
Protecting Data Validation List from being modified in the formulabar Maddoktor Excel Programming 11 January 17th 07 03:25 AM
Protecting cells with data validation cottage6 Excel Programming 0 November 4th 04 07:24 PM
Protecting buttons with VB code rather than protecting sheets/books? StargateFanFromWork Excel Programming 2 July 16th 04 04:03 PM
Protecting Data Validation from being overwritten Casey[_7_] Excel Programming 0 April 7th 04 04:48 PM


All times are GMT +1. The time now is 05:24 PM.

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

About Us

"It's about Microsoft Excel"