• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Macro with Protect Sheets + Format Cells

Soleblue

New Member
Good evening everyone,
sorry for the terrible English.
I have this "Protect" macro that protects all my sheets, and it works perfectly.

Private Sub Protect()
For Sheets = 1 To ActiveWorkbook.Worksheets.Count
Sheets(Sheets).Protect Password:="pippo"
Next

End Sub

I'd like to add the "Format Cells" function.
I tried using the auto-help feature, but it it's very long. I only included 3 sheets in the example.

Sub Macro1()
'
' Macro1 Macro
Sheets("Mike").Select
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _
, AllowFormattingCells:=True
Sheets("Andrea").Select
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _
, AllowFormattingCells:=True
Sheets("Alex").Select
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _
, AllowFormattingCells:=True
End Sub


Is there a function I can add to my macro above that also formats the cells? (keeping the password)
Using 365 Italian
Thanks for your help

Grazie:)
 

Attachments

Are You sure that Your above password is ... correct?
Anyway, You could test something like in this sample file's macro.
Hi vletm :)
You're right! I got the password wrong.o_O
But I tried the macro in the original file and it works perfectly.
Thank you so much. The magic of Excel is incredible, and you're amazing.
Gracias!!!
Dilly
 
Back
Top