ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   control form macros and protected sheets (https://www.excelbanter.com/excel-discussion-misc-queries/117481-control-form-macros-protected-sheets.html)

Greyson

control form macros and protected sheets
 
I have a large worksheet that requires data entry by other users. There are
both locked and unlocked cells within the worksheet. The database contains
several control form macros that cannot run if the sheet is protected.
Portions of the worksheet require sheet protection to prevent changes. Is
there a way to protect the worksheet and still run the macros?

Jim Cone

control form macros and protected sheets
 
Place new code in the macros to unprotect the sheet, run the existing
code then protect the sheet.

Sub ControlFormMacro
Worksheets("LargeWorksheet").Unprotect "password"
'code to do stuff
Worksheets("LargeWorksheet").Protect "password"
End Sub
----------
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware


"Greyson"
wrote in message
I have a large worksheet that requires data entry by other users. There are
both locked and unlocked cells within the worksheet. The database contains
several control form macros that cannot run if the sheet is protected.
Portions of the worksheet require sheet protection to prevent changes. Is
there a way to protect the worksheet and still run the macros?


All times are GMT +1. The time now is 12:54 PM.

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