View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default Macro not working when Sheet protected

You can unprotect your sheet in the code
and protect it again after your code is ready.

But I like this way.

Protect your worksheets with code like this
Place this in the Thisworkbook module.

The macro's will be working now
It will only protect for the userfaceonly

Private Sub Workbook_Open()
Dim sh As Worksheet
Application.ScreenUpdating = False
For Each sh In ThisWorkbook.Worksheets
sh.Protect userinterfaceonly:=True
Next sh
Application.ScreenUpdating = True
End Sub




--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"dlindberg" wrote in message ...
hoping you can help. I've created a macro, which works
fine. Than I've protected the sheet. I have unlocked the
cells that are effected by the protection, however when
the macro sorts, I get an error. Any ideas of a work
around.