Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have two questions but I think the first answer will solve the second.
First: Why does the following line error out with "Run-time error '450': Wrong number of arguments or invalid property assignment? Debug.Print ActiveWindow.SelectedSheets (I thought this line earlier today?) Now the 2nd question; I'm trying to protect / unprotect a group of selected sheets using the following code but it errors out if more than one worksheet is selected with "Run-time error '1004': Method 'Protect' (or 'Unprotect') of object '_Worksheet' failed. Sub Protect_Switch() ' Alternate WorkSheet Protection ON or OFF Dim sh As Worksheet For Each sh In ActiveWindow.SelectedSheets If sh.ProtectContents = True Then sh.Unprotect Else sh.Protect DrawingObjects:=True, Contents:=True, Scenarios:= _ False, AllowSorting:=True, AllowFiltering:=True End If Next sh End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Are there ways to protect multiple sheets at once? | New Users to Excel | |||
Protect Selected Sheets | Excel Programming | |||
Macro to protect multiple sheets? | Excel Worksheet Functions | |||
How do I protect multiple sheets at one time? | Excel Worksheet Functions | |||
Protect multiple sheets in one time | Excel Programming |