L
Lois
Hi,
I have the following macro written in spreadsheets to protect them, however,
in some workbooks there are 12 month tabs & a 'workings' tab. in the
workings tab i require different functionality (e.g. inserting rows &
columns) than the 12 month tabs. How do i change the macro to reflect this?
Sub ProtectAll()
Dim sPassword As String
sPassword = "LMW5487"
If Application.InputBox( _
Prompt:="Please enter the password", _
Title:="Password", _
Type:=2) <> sPassword Then
MsgBox "Wrong password!"
Exit Sub
End If
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
ws.Protect Password:="LMW5487", DrawingObjects:=False, Contents:=True,
Scenarios:= _
True, AllowFormattingCells:=True, AllowSorting:=True,
AllowDeletingRows:=True, AllowInsertingRows:=True, AllowFormattingRows:=True,
AllowFiltering:= _
True, AllowFormattingColumns:=True
Next ws
End Sub
I have the following macro written in spreadsheets to protect them, however,
in some workbooks there are 12 month tabs & a 'workings' tab. in the
workings tab i require different functionality (e.g. inserting rows &
columns) than the 12 month tabs. How do i change the macro to reflect this?
Sub ProtectAll()
Dim sPassword As String
sPassword = "LMW5487"
If Application.InputBox( _
Prompt:="Please enter the password", _
Title:="Password", _
Type:=2) <> sPassword Then
MsgBox "Wrong password!"
Exit Sub
End If
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
ws.Protect Password:="LMW5487", DrawingObjects:=False, Contents:=True,
Scenarios:= _
True, AllowFormattingCells:=True, AllowSorting:=True,
AllowDeletingRows:=True, AllowInsertingRows:=True, AllowFormattingRows:=True,
AllowFiltering:= _
True, AllowFormattingColumns:=True
Next ws
End Sub