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: 4
Default Excel97 - Worksheet Protection Question

Trying to create a form for users which is locked until they press a button
to enter values. I'm having a problem getting the worksheet to unlock so I
can set a range for data entry then lock again. Code fragment is:

Worksheets(WkShtName).Unprotect
Worksheets(WkShtName).Range("B3").Locked = False
Worksheets(WkShtName).Protect

When I try to test this I get an "Error 1004 Unprotect Method of Worksheet
Class failed" on the first line if the Worksheet is locked, and "unable to
set the Locked property of the Range class" if the sheet is unlocked when I
invoke the code.

Stranger still, the code is invoked from a button handler - if I use the
button I get error above, but if I run the code under the VBA Editor, then
it runs OK IF the worksheet is unprotected..hmmm

Can anyone point me in the right direction to make this work please

Thanks

Russell





 
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
Worksheet Protection Question Pat Excel Discussion (Misc queries) 1 February 4th 09 11:14 PM
Worksheet protection question Dominic Excel Discussion (Misc queries) 3 August 17th 07 07:46 PM
A Worksheet Protection Question PA New Users to Excel 1 December 8th 06 09:44 AM
Excel97 Question?? Quinncom Excel Discussion (Misc queries) 2 October 27th 05 03:17 PM
question about worksheet protection using userinterfaceonly:=true David Brisco Excel Programming 0 February 9th 04 09:25 PM


All times are GMT +1. The time now is 06:03 AM.

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"