LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Worksheet_Change stoped working after sheet is protected

Would someone be so kind and make a test for me please

Please create new workbook and in new sheet set validation data for
list i.e. 1;2;3 for cells E2:E10. Unlock the cells E2:E10. Then put
following the code in sheet

------------------
Sub Worksheet_Change(ByVal Target As Range)

If HasValidation(Range("E2:E10")) = False Then


Application.Undo

MsgBox "Operation Canceled", vbCritical '

Else

Exit Sub
End If

End Sub



Function HasValidation(r) As Boolean

' Returns True if every cell in Range r uses Data Validation

On Error Resume Next

x = r.Validation.Type

If Err.Number = 0 Then HasValidation = True Else HasValidation =
False

End Function
---------------------

After that try to copy (on unprotected sheet) value form blank cell A1
and paste it in E2. It should be blocked with message operation
canceled. If that works try to do the same with sheet protected. It it
works only me have the problem. If not there is something bigger :)

Thanks in advance
PAT

 
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
Autofilter not working on protected sheet. parahumanoid[_2_] Excel Discussion (Misc queries) 1 November 1st 09 05:52 PM
Filters not working on Protected sheet Krishna Kumar L Excel Discussion (Misc queries) 1 February 9th 09 07:08 AM
Hyperlinks not working after sheet is protected.... TG Excel Discussion (Misc queries) 1 December 30th 08 12:43 AM
How to have Autofilter working in a protected sheet? dilettante Excel Programming 3 October 3rd 06 07:58 PM
formulae have stoped working on an excel sheet annoyed Excel Worksheet Functions 1 September 20th 05 09:39 PM


All times are GMT +1. The time now is 02:27 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"