protect formulas

  • Thread starter Thread starter Osmario Avila
  • Start date Start date
O

Osmario Avila

Private Sub Workbook_Open()
Worksheets(1).EnableAutoFilter = True
Worksheets(1).EnableOutlining = True
Worksheets(1).Protect UserInterfaceOnly:=True
End Sub

Hi!
using this code I protect only sheet1, but I need protect both sheet1
and sheet2. Does anybody knows how to?

Thanks in advance
Osmario.
 
Private Sub Workbook_Open()
Worksheets(1).EnableAutoFilter = True
Worksheets(1).EnableOutlining = True
Worksheets(1).Protect UserInterfaceOnly:=True
Worksheets(2).EnableAutoFilter = True
Worksheets(2).EnableOutlining = True
Worksheets(2).Protect UserInterfaceOnly:=True
End Sub

or even:

Private Sub Workbook_Open()
dim iCtr as long
for ictr = 1 to 2
with worksheets(ictr)
.activate
.EnableAutoFilter = True
.EnableOutlining = True
.Protect UserInterfaceOnly:=True
end with
next ictr
End Sub

I think Tom Ogilvy has posted some notes about protection failing and one fix
was to active the worksheet first.
 
Back
Top