Protecting worksheet

G

Guest

Hi
I have a worksheet that is used to display the data by selecting various options in the different controls. I want that no user is able to change anything except select different options. I first unlocked various objects and cells and password protected it( I do not want the code to be visible) but the problem is that even by first unlocking different cells and objects , the code is giving run-time error
Is there any solution to it
TI
Shilps
 
B

Bob Flanagan

Shilps, copy your code into a post so we can see it. (do not attach a
workbook)

Bob Flanagan
Macro Systems
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel

Shilps said:
Hi,
I have a worksheet that is used to display the data by selecting various
options in the different controls. I want that no user is able to change
anything except select different options. I first unlocked various objects
and cells and password protected it( I do not want the code to be visible)
but the problem is that even by first unlocking different cells and objects
, the code is giving run-time error.
 
T

Tom Ogilvy

At the top of the code try putting in code like

ActiveSheet.Protect UserInterFaceOnly:=True

if you are using Excel 2002 or later, you need to include

ActiveSheet.Protect Password:="ABCD", UserInterFaceOnly:=True

otherwise, you have have your code unprotect the sheet, do its work,
reprotect the sheet.

--
Regards,
Tom Ogilvy

Shilps said:
Hi,
I have a worksheet that is used to display the data by selecting various
options in the different controls. I want that no user is able to change
anything except select different options. I first unlocked various objects
and cells and password protected it( I do not want the code to be visible)
but the problem is that even by first unlocking different cells and objects
, the code is giving run-time error.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top