Macro problem when sheet protected

G

Guest

I have run into a problem with macros not executing when a sheet is protected
in Excel. I use Office XP.

Any ideas on this?

Thanks,
Les
 
G

Guest

Sub MyMacro()
On Error goto ErrHandler
worksheets("Sheet1").Unprotect Password:="ABC"
' current code

ErrHandler:
Worksheets("sheet1").Protect Password:="ABC"
End Sub
 
G

Guest

Does this code still keep the sheet protected? Also, I have entered macros
before. Is this going to be an EVENT macro?

Thanks,
Les
 
G

Guest

It unprotects the sheet while it runs and protects it again at the end.

It is meant to present a concept to integrate with your existing macro.
 
G

Guest

It unprotects while the macro executes and then protects it again? I am
trying to only have users access certain cells.

The spreadsheet I initially had the problem with was one that a user could
input their paycheck info for a year. Various statistical info was
calculated on the same and other sheets. I had command buttons that were
used to navigate to specific paychecks (if there were three separate incomes
from three jobs) and to navigate to the other sheets.

If my interpretation is correct, is the macro entered as an EVENT?

Thanks,
Les
 

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