ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   protect sheets allow buttons (https://www.excelbanter.com/excel-programming/356570-protect-sheets-allow-buttons.html)

pywhacket

protect sheets allow buttons
 
How do I protect a worksheet but allow a control button to work?

Thank you!

Candyman

protect sheets allow buttons
 
You may want to allow the code to unlock the worksheet...
Function ThePassword()
ThePassword = "Excel_1"
End Function
Sub Add_Member()
Dim mName As String
ActiveWorkbook.Unprotect (ThePassword())
Worksheets("Template").Unprotect (ThePassword())
''' Ask for new name
mName = InputBox("Enter new member's name.")
Sheets("Template").Copy After:=Sheets(Sheets.Count)
<do other stuff
Worksheets("Menu").Select
Worksheets("Template").Protect (ThePassword())
ActiveWorkbook.Protect
Exit Sub

"pywhacket" wrote:

How do I protect a worksheet but allow a control button to work?

Thank you!



All times are GMT +1. The time now is 03:46 AM.

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