Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Protecting excel worksheet 1

Status
Not open for further replies.

pruleone

Technical User
Apr 14, 2009
74
EE
Hi,

I would like use VBA code to protect excel worksheet and same time give users option to format cells, columns, rows.

I have recorded two different VBA codes but don't know how to merge them. Maybe someone can help?

First code:
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _
, AllowFormattingCells:=True, AllowFormattingColumns:=True, _
AllowFormattingRows:=True

Second code:
ActiveSheet.Protect Password:="1
 
ActiveSheet.Protect Password:="1", DrawingObjects:=True, Contents:=True, Scenarios:=True _
, AllowFormattingCells:=True, AllowFormattingColumns:=True, _
AllowFormattingRows:=True


Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thank you,

I tried so, but seams that I made something wrong.
 



Turn on you macro recorder and record doing exactly what you need to happen.

Then observe your recorded code.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Hi Skip

I don't know if this is appropriate but I'm going to jump in with both feet. I have used this site for a long time and mostly just observing and getting info. I just wanted to say that using the macro recorder is the best advice I have gotten from you (although indirectly). I have a postnote on my monitor "did you try the macro recorder?". Anyways thanks again.

Be Alert, America needs more lerts
 
Macro recorder is nice thing but it didn't somehow record all I entered that's why I had question :)
 


...but it didn't somehow record all I entered ...
That would have been pertinent to declare.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top