![]() |
Excel97 - Worksheet Protection Question
This is a bug in 97
You can put this line in your code(first line) ActiveCell.Activate Or Set the SetFocusOnClick property of the button to false in the properties of the button -- Regards Ron de Bruin (Win XP Pro SP-1 XL2000-2003) www.rondebruin.nl "Russell Plummer" wrote in message ... 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 |
Excel97 - Worksheet Protection Question
Thanks Ron,
I thought it was me! Russell "Ron de Bruin" wrote in message ... This is a bug in 97 You can put this line in your code(first line) ActiveCell.Activate Or Set the SetFocusOnClick property of the button to false in the properties of the button -- Regards Ron de Bruin (Win XP Pro SP-1 XL2000-2003) www.rondebruin.nl "Russell Plummer" wrote in message ... 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 |
All times are GMT +1. The time now is 01:57 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com