protect formulas

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.
 
D

Dave Peterson

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.
 

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