ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro not working when Sheet protected (https://www.excelbanter.com/excel-programming/272668-re-macro-not-working-when-sheet-protected.html)

Ron de Bruin

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.




dlidnber

Macro not working when Sheet protected
 
thank you so much for the help.


All times are GMT +1. The time now is 10:55 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com