LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 407
Default protect all sheets macro crashes when sheet is hidden

I attempted to edit a macro from you folks to protect all sheets, because I
noticed that, if I hid some sheets, then the macro crashed. I added two
rows, the if statement and the rem statement. This is still crashing with a
worksheet hidden. I guess it may be that it can't select a sheet if it is
hidden, so that my if statement is too late, or else my syntax is wrong!
Kindly help.

Thanks!
Dean

Sub ProtectAllWorksheets()
Dim wks As Worksheet
For Each wks In Worksheets
If ActiveSheet.Hidden = True Then GoTo L1

wks.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _
, AllowFormattingCells:=True, AllowFormattingColumns:=True, _
AllowFormattingRows:=True

L1: Rem
Next wks
End Sub


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hide or protect hidden rows/columns - macro help ttbbgg Excel Programming 4 October 25th 06 04:44 PM
Protect hidden rows/columns -macro help ttbbgg Excel Discussion (Misc queries) 4 October 25th 06 04:20 PM
How do I password protect hidden sheet? Mascot Excel Discussion (Misc queries) 1 October 5th 06 03:52 PM
"With Sheets" Issue - macro on one sheet to affect hidden rows on other sheets Punsterr Excel Programming 3 February 21st 06 04:01 AM
Protect Sheet > All sheets Adam Excel Discussion (Misc queries) 3 January 31st 05 04:37 PM


All times are GMT +1. The time now is 10:31 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"