lock a cell from users but not macros

M

Miree

I have a work sheet my macro copys data into. When i just protect the sheet
the macro will not run. Is there a way to lock it so the macro will still
work but the users can not edit the data.

Thank you
 
P

Per Jessen

Hi

Unprotect the sheet at the top of the macro and then re-protect at the end.

Regards,
Per
 
M

Miree

Is there a way to get this to work with a password? when i tried to do it
with password it needed a user input, to unprotect, i dont want my users to
have the password. Also it doesn't lock with a pass word
 
M

Mike H

Try this

ActiveSheet.Unprotect Password:="MyPass"
' do things
ActiveSheet.Protect Password:="MyPass"

Mike
 
P

Per Jessen

Use this syntax:

ActiveWorkbook.Unprotect Password:="JustMe"
ActiveWorkbook.Protect Password:="JustMe"

Regards,
Per
 

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