View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.excel
stef stef is offline
external usenet poster
 
Posts: 20
Default bug in protect-unprotect macro

Excel 2002 SP3
Win XP Pro

*Follow-up to: microsoft.public.excel.programming*

Hi,

I have a bug with the line ".EnableSelection = xlUnlockedCells" in this
macro:

Sub ProtectAllSheets()
Application.ScreenUpdating = False
Dim n As Single
For n = 1 To Sheets.Count
With Sheets(n)
.Protect Password:="nosecret"
.EnableSelection = xlUnlockedCells
End With
Next n
Application.ScreenUpdating = True
End Sub

It's always worked in the past and I can't understand what is happening now.

Be easy on me as I am a newbie at XL macros/VBA....