Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / September 2007

Tip: Looking for answers? Try searching our database.

Protecting validation

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Asif - 27 Sep 2007 16:13 GMT
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

Signature

Thanx & regards,
Asif

Tom Ogilvy - 27 Sep 2007 16:54 GMT
Why not use the selection change event.  It the TARGET has data validation

application.CutCopyMode = False

Signature

regards,
Tom Ogilvy

> I have created data validations sheet and want to protect from getting
> spoiled through cut, paste, clear, etc. I have written following code but
[quoted text clipped - 16 lines]
> End With
> End Sub
Asif - 27 Sep 2007 17:09 GMT
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.

Signature

Thanx & regards,
Asif

> Why not use the selection change event.  It the TARGET has data validation
>
[quoted text clipped - 20 lines]
> > End With
> > End Sub
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.