Use Macro to protect choosen sheets in workbook
I have a workbook with 10 sheets, 7 sheets used for Data entry (which I don't
want anyone to be able to change) and 3 for anybody to work with the data on a day to day basis without them being able to corrupt the original. I know of the Macro to protect the whole workbook but what I would like is to be able to protect the 7 Data sheets and leave the 3 working sheets unlocked. Hope this makes sense to you. Thx in advance |
Use Macro to protect choosen sheets in workbook
Maybe something like:
Option Explicit Sub testme() Dim myPWD As String Dim wks As Worksheet myPWD = "TopSeCrET" For Each wks In ActiveWorkbook.Worksheets Select Case LCase(wks.Name) 'make sure you use lower case when you change these! Case Is = "sheet1", "sheet2", "sheet5", "sheet99", _ "sheet100", "another sheet", "and one more", "lastone" wks.Protect Password:=myPWD Case Else 'do nothing End Select Next wks End Sub kevhatch wrote: I have a workbook with 10 sheets, 7 sheets used for Data entry (which I don't want anyone to be able to change) and 3 for anybody to work with the data on a day to day basis without them being able to corrupt the original. I know of the Macro to protect the whole workbook but what I would like is to be able to protect the 7 Data sheets and leave the 3 working sheets unlocked. Hope this makes sense to you. Thx in advance -- Dave Peterson |
All times are GMT +1. The time now is 12:44 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com