sheet protection

N

Nasir.Munir

Hi and thanks in advance,
I have this problem of unprotecting a sheet, allowing for certain
features and want to protect that with a password again. When I do
that, I am getting syntax error. Someone please help,

code:
Sub Macro4()
ActiveSheet.Unprotect Password:="hiacsc"

ActiveSheet.Protect Password:="hiacsc" DrawingObjects:=True, _
Contents:=True, Scenarios:=True , AllowFormattingCells:=True,
_
AllowFormatingColumns:=True, _
AllowFormattingRows:=True, AllowSorting:=True,
AllowFiltering:=True
ActiveSheet.EnableSelection = xlNoRestrictions
End Sub

If I omit Password for protecting the sheet it does what I want, but
when I protect that with Password atrribute, it is giving me syntax
error.
 
N

Norman Jones

Hi Nasir,

Try changing:
ActiveSheet.Protect Password:="hiacsc" DrawingObjects:=True, _

to

ActiveSheet.Protect Password:="hiacsc", DrawingObjects:=True, _


Note the comma after "hiacsc"
 

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