run macros on protected sheet

G

Guest

Is it possible to protect a sheet (Excel 2003) and still allow macros buttons
to funcion without adding unprotect and protect at the beginning and end
(which of course would prompt for the password).
 
B

Bob Phillips

You pass the password to unprotect etc.

Activesheet.Unprotect Password:="mypassword"

--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)
 
G

Guest

I don't want to put the password there.
Bob Phillips said:
You pass the password to unprotect etc.

Activesheet.Unprotect Password:="mypassword"

--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)
 
G

Gord Dibben

Why not?

You can always protect your VBA Project from prying eyes if that's what concerns
you.

Select your workbook/project in the VBE and right-click>VBA Project
Properties>Protection.

Note: after setting a password to view you must save the workbook.


Gord Dibben MS Excel MVP
 
B

Bob Phillips

Well you have a choice, you put your password there, you lete the password
prompt pop-up, or you have no password. Your choice.

--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)
 

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