LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default Problem with using Protect when userinterfaceonly:=True

Hi

On workbook open, a procedure runs through all sheets and sets
following:

Worksheets(i).Protect password:="***", userinterfaceonly:=True

This worked fine, until I started developing a userform which
calculates some stuff and lets the user click a button to enter
the result into a cell.

What happens now is that any changes to any sheet (triggering
WorkSheet_Change event) works fine, *except* when the data is
entered via the userform. When this happens, the WorkSheet_Change
procedure runs correctly up to a point whe

Worksheets("summary").Range("i" & h & ":j" &
h).Interior.ColorIndex = 34

always fails. (*only* and always at this line. Any normal user
entry into a cell triggers this procedure without fault.
(including this line every time). The error generated is: Run time
error '1004' Unable to set the ColorIndex property of the Interior
class

A bodge to get around this problem is that I wrap the line which
places the userform result into the cell with a sheet
unprotect/protect. Although this solves the problem, I can't
figure out why. I shouldn't need to make this bodge.

This is part of the code in the button click event procedure to
illustrate the bodge.

Worksheets("summary").UnProtect password:="***"
ActiveSheet.Cells(ActiveCell.Row, 11) = r ' only from this
trigger does the above failure occur
Worksheets("summary").Protect password:="***",
userinterfaceonly:=True


Can anyone point me in a direction that may lead to a solution for
this problem. I could post whatever code I have if needed, but
have limited to above in the first instance.

Any help would be very much appreciated.

regards,
--
Les Hay, Livingston. Scotland
leshay at leshay dot freeserve dot co dot uk


 
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
Userinterfaceonly Tami Excel Worksheet Functions 5 August 31st 09 07:37 PM
Excel macro protect problem Zozi Excel Discussion (Misc queries) 3 March 2nd 09 12:56 AM
UserInterfaceOnly & Password Protection D.Parker Excel Discussion (Misc queries) 6 October 9th 07 09:46 PM
UserInterfaceOnly D.Parker Excel Discussion (Misc queries) 1 May 17th 05 08:51 PM
Protection UserInterfaceOnly reading Hidden Formulas Rik Ditter Excel Programming 1 July 12th 03 12:50 PM


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