ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   allow macros in protected worksheet (https://www.excelbanter.com/excel-worksheet-functions/27746-allow-macros-protected-worksheet.html)

Marge

allow macros in protected worksheet
 
I have a worksheet with contains macros. I want to protect the worksheet,
but allow the macros to run. When I protect the worksheet, the macros are no
longer enabled. How do I correct this?

Paul B

Marge, use user inter face to protect the sheet, then your macros will be
able to run, something like this

Private Sub Workbook_Open()

Worksheets("sheet1").Protect password:="test", userInterfaceOnly:=True

End Sub



This is not retained with the workbook when saved so it must be reset when
the workbook is re-opened, thats is why it is put in the workbook open event
of the this workbook code
--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003



"Marge" wrote in message
...
I have a worksheet with contains macros. I want to protect the worksheet,
but allow the macros to run. When I protect the worksheet, the macros are
no
longer enabled. How do I correct this?





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

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