Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 75
Default Problems on Protected Sheet

Hi all,

I have a problem of adding validation to unlocked cells in a protected
sheet.

On Workbook_Open(), the following protection is made:

For Each wks In InputSheets
wks.EnableSelection = xlUnlockedCells
wks.Protect Password:="12345", Contents:=True, _
DrawingObjects:=True, userinterfaceonly:=True
Next

On the Worsheet_SelectionChange() event of the protected sheet, the
following validation is performed on the _unlocked_ range:

With UnlockedCell.Validation
.Delete
.Add Type:=xlValidateList, Formula1:="=" & ListSource
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = False
.ShowError = False
End With

However, whenever a cell in the unlocked range is selected, the debugger
turned on, highlighted the line ".Add Type = .... " and the error is
"Application-defined or object defined error". I am baffled because

1. The range in question is _unlocked_ one.
2. I have set the UserInterfaceOnly argument in the Protect method to true.

Anybody has ideas on what's happened? Thanks for your advice in advance.

Frederick Chow
However,


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default Problems on Protected Sheet

What is "ListSource" ?
A variable or named range ?

tim


--
Tim Williams
Palo Alto, CA


"Frederick Chow" wrote in message
...
Hi all,

I have a problem of adding validation to unlocked cells in a protected
sheet.

On Workbook_Open(), the following protection is made:

For Each wks In InputSheets
wks.EnableSelection = xlUnlockedCells
wks.Protect Password:="12345", Contents:=True, _
DrawingObjects:=True, userinterfaceonly:=True
Next

On the Worsheet_SelectionChange() event of the protected sheet, the
following validation is performed on the _unlocked_ range:

With UnlockedCell.Validation
.Delete
.Add Type:=xlValidateList, Formula1:="=" & ListSource
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = False
.ShowError = False
End With

However, whenever a cell in the unlocked range is selected, the debugger
turned on, highlighted the line ".Add Type = .... " and the error is
"Application-defined or object defined error". I am baffled because

1. The range in question is _unlocked_ one.
2. I have set the UserInterfaceOnly argument in the Protect method to

true.

Anybody has ideas on what's happened? Thanks for your advice in advance.

Frederick Chow
However,




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 75
Default Problems on Protected Sheet

It is a named range. No problem when the worksheet is not protected.

"Tim Williams" <timjwilliams at gmail dot com wrote in message
...
What is "ListSource" ?
A variable or named range ?

tim


--
Tim Williams
Palo Alto, CA


"Frederick Chow" wrote in message
...
Hi all,

I have a problem of adding validation to unlocked cells in a protected
sheet.

On Workbook_Open(), the following protection is made:

For Each wks In InputSheets
wks.EnableSelection = xlUnlockedCells
wks.Protect Password:="12345", Contents:=True, _
DrawingObjects:=True, userinterfaceonly:=True
Next

On the Worsheet_SelectionChange() event of the protected sheet, the
following validation is performed on the _unlocked_ range:

With UnlockedCell.Validation
.Delete
.Add Type:=xlValidateList, Formula1:="=" & ListSource
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = False
.ShowError = False
End With

However, whenever a cell in the unlocked range is selected, the debugger
turned on, highlighted the line ".Add Type = .... " and the error is
"Application-defined or object defined error". I am baffled because

1. The range in question is _unlocked_ one.
2. I have set the UserInterfaceOnly argument in the Protect method to

true.

Anybody has ideas on what's happened? Thanks for your advice in advance.

Frederick Chow
However,






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
Problems with IRM protected files created before 18/11/09 gwaxiom Excel Discussion (Misc queries) 0 November 21st 09 09:30 PM
Sheet Information - Is sheet protected? lbit Excel Discussion (Misc queries) 1 November 15th 07 08:06 PM
Protected sheet to unprotected sheet [email protected] Excel Worksheet Functions 2 October 26th 05 05:30 PM
problems w solution 4 enable AutoFilter for a protected worksheet sharona Excel Programming 1 October 13th 05 04:59 PM
excel - macro code to open a protected sheet, enter passowrd, and then protect sheet arunjoshi[_5_] Excel Programming 1 May 2nd 04 03:50 PM


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