vb code help
Hi,
If you want to do it to all the sheets in the workbook
Private Sub Workbook_Open()
Dim sh As Worksheet
For Each sh In Worksheets
With sh
.Protect Password:="hi", userinterfaceonly:=True
.EnableOutlining = True
.EnableAutoFilter = True
End With
Next sh
End Sub
You are using the Auto_Open subroutine, instead you should consider using
the Workbook_Open()
This code goes into the thisWorkbook object in the VBA editior.
If this helps, please click the Yes button
Cheers,
Shane Devenshire
"K-Man" wrote:
Hi how do I edit following code for multiple worksheets?
Option Explicit
Sub auto_open()
With Worksheets("sheet1")
.Protect Password:="hi", userinterfaceonly:=True
.EnableOutlining = True
'.EnableAutoFilter = True
End With
End Sub
Thanks in advance..
|